Does anyone know of a vim plugin or script to convert special characters to their corresponding HTML

Posted by Alan on Stack Overflow See other posts from Stack Overflow or by Alan
Published on 2010-06-16T15:53:54Z Indexed on 2010/06/17 12:13 UTC
Read the original article Hit count: 211

Filed under:

I develop websites for corporate clients, so we see the ®, ™, etc. chars a whole lot. Sometimes I paste in huge blocks of copy, which might even contain pretty quotes (“ ”) or other strange characters from word processors.

So, my question is this: Does anyone know of a vim plugin or script that can, in one fell swoop, convert all these characters to html entities?

I think this covers all the bases of the entities it would be nice to have: http://web.forret.com/tools/charmap.asp

So, for the characters above, they would be replaced with ®, ™, “, ”, etc.

I tried the htmlspecialchars vimball (http://www.vim.org/scripts/script.php?script_id=2377), but no dice. It only performs its replacement like the PHP htmlsepcialchars function, replacing html-conflicting characters, and doesn't cover any additional special characters.

© Stack Overflow or respective owner

Related posts about vim