Change emmet's leader key in Vim
-
21-12-2019 - |
Question
Is it possible to to change the way you expand emmet code into HTML?
The default is ctrl+y+, and thats about two too many keys for my liking.
In sublime I just enter the emmet code and hit tab and it expands it. Is there a way to have it do this vim?
Solution
:help emmet-customize
explains how to customize Emmet's mappings. As a "noob", you owe it to yourself to get used to Vim's documentation.
You could add the line below to ~/.vimr/after/ftplugin/html.vim
:
inoremap <buffer> <tab> <plug>(emmet-expand-abbr)
However, Emmet has a lot of features accessible via a number of mappings all using the same "leader", <C-y>
so I'm not sure it is a good idea to take the direction you want to take.
OTHER TIPS
Maybe you should add the line below to your .vimrc
:
let g:user_emmet_expandabbr_key = '<Tab>'
I added to my configuration the following mapping
imap ,, <C-y>,
So for example, if I type div
or any other emmet expression, then I just type ,,
and it gets completed.