Reputation: 1507
Ok here is what I want to accomplish:
INSERT
mode I would like emmet to autocomplete with the TAB
keyHere is what I have tried
let g:user_emmet_expandabbr_key = '<tab>'
(Only works in NORMAL
mode)Though the above code is useful, I need it to work in INSERT
mode
I am transferring over from Sublime Text to VIM and I miss having the Emmet functionality so easily accessible. Any ideas as to how I can achieve this?
Thanks in advance.
Upvotes: 5
Views: 3249
Reputation: 1507
Solved my problem by including the following lines in my .vimrc
file.
let g:user_emmet_expandabbr_key='<Tab>'
imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")
Now I can use the TAB
key to both indent and activate Emmet snippets in INSERT
mode :D
Upvotes: 14
Reputation: 2742
I'm guessing that the reason for your setting not working in INSERT
mode is because <tab>
is mapped to something elsewhere (most likely with some auto-completion plugins). You can try to find what's mapped by :verbose imap <tab>
when editing HTML files and disable that, but I think the simpler solution is to override the mapping yourself, like this:
augroup EmmetSettings
autocmd! FileType html imap <tab> <plug>(emmet-expand-abbr)
augroup END
To know what is done above, see :h autocmd
(and :h augroup
). Basically it's telling vim to execute the specified command when editing html
files. To know about other mappings you can use, see the doc.
Upvotes: 1