mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.42k stars 411 forks source link

Can't configure tab expansion via autocmd FileType #385

Open aldanor opened 7 years ago

aldanor commented 7 years ago

If I do this:

let g:user_emmet_install_global = 0
autocmd FileType html EmmetInstall
autocmd FileType html imap <tab> <expr> <plug>(emmet-expand-abbr)
" or autocmd FileType html imap <tab> <expr> emmet#expandAbbrIntelligent("\<tab>")

-- it doesn't change anything, things still do expand with <C-y>, though. I can confirm that the filetype of the buffer is indeed "html" and that autocmd commands do generally execute.

If, however, I manually do

:EmmetInstall
:imap <tab> <expr> emmet#expandAbbrIntelligent("\<tab>")

from command line of the html buffer, it starts expanding in insert mode with TAB, as expected.

Is there any catch? Would appreciate any help, thanks.

robinknaapen commented 7 years ago

I use this

au FileType html,gohtmltmpl imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")

It works fine for me

verschmelzen commented 6 years ago

Have same issue, after manual setup when I've opened buffer works. However solution above does not help. My configuration:


let g:user_emmet_install_global = 0
autocmd FileType html,djangohtml EmmetInstall |
" Use natural way to expand emmet expressions
            \ imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")