sponsor Vim development Vim logo Vim Book Ad

htmlmap : macros to help type HTML entities

 script karma  Rating 21/8, Downloaded by 2595  Comments, bugs, improvements  Vim wiki

created by
Antoine Mechelynck
script type
This script defines a number of macros, all for insert mode in HTML files. Once installed, it will automatically "translate" characters into their &...; strings: so for instance if you type "" the characters " & a u m l ; " will be inserted (without the intervening spaces). A mechanism similar to Vim's "digraphs" is also supported but with another key (F12, but you can replace it with something else if it doesn't suit you), so that e.g. "<F12>oe" inserts the numeric code for the oe ligature (above 255, some browsers know the numeric codes but not the symbolic entities such as &oelig;).

The script contains a lot of comments to make it largely self-explanatory.
install details
Add the line

    source <path>/htmlmap.vim

(where <path> is the directory where you downloaded this script) to the file ~/.vim/ftplugin/after/html.vim (for Unix) or ~/vimfiles/ftplugin/after/html.vim (for Windows). Create the file and the directories if they don't yet exist.

Optionally, add

    imap <F12> <C-K>

to your vimrc if you want to use the same key as a digraph prefix for entities in HTML and for characters in other files.

Note that if your vim does not support autocommands you can still make this script work by sourcing it manually in the buffer(s) where you need it.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
htmlmap.vim 1.01pl4 2003-02-02 6.0 Ingo Lantschner Euro-Sign added.
htmlmap.vim 1.01pl3 2002-10-24 6.0 Antoine Mechelynck - Bugfix for some rare Cyrillic characters
- Bugfix for circumflex-accented o and O
- Improvement: Added map for non-breaking space (but commented-out by default)
- Cosmetic improvement: Release history added.
htmlmap.vim 1.01pl1 2002-03-31 6.0 Antoine Mechelynck Bugfix for Cyrillic uppercase  io, dje, gje and Ukrainian ie (was 1024-1027, should be 1025-1028)
htmlmap.vim 1.01 2002-03-30 6.0 Antoine Mechelynck bugfix = incorrect output for <F12>B= ; <F12>V= not recognized (Cyrillic uppercase B and V)
htmlmap.vim 1.0 2002-03-29 6.0 Antoine Mechelynck Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.