Question

I just installed Emmet VIM plugin which looks very interesting. The "trigger key combination" to activate the Emmet plugin functionality is not the best it could be. Therefore I am trying to remap it in my vimrc file. I have successfully done that to remap the Escape key as follows:

inoremap ;; <ESC>

This allows me to type the semi-colon character ";" in rapid succession to get out of the insert mode and get in the normal mode. However it does not work when I try to remap the Emmet trigger key which is , (to be read as Control key and "y" key, followed by the "," key). I have tried the following combinations:

inoremap hh <C-y> ,
inoremap hh <C-y>,
inoremap hh <C-y,>

As you can see above, I am trying to map "hh" key combination to the Emmet VIM's trigger keys.

Thanks in advance for your time.

Bharat

Was it helpful?

Solution

inoremap means that if there is a mapping (such as to ,) it will not be followed via the key combination for the mapping. You probably want imap

imap hh <C-y>,

OTHER TIPS

I use that:

let g:user_emmet_leader_key=','

So ',,' triggers Emmet.

Emmet VIM provides a way to redefine it:

let g:user_emmet_leader_key='hh'

Found on the README: https://github.com/mattn/emmet-vim/#redefine-trigger-key

The smarter way is to use Expression Mappings, like:

au FileType html imap <buffer><expr><tab> <sid>zen_html_tab()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top