Mark
Mark

Reputation: 3197

Change emmet's leader key in Vim

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?

Upvotes: 6

Views: 5994

Answers (4)

Abruzzi
Abruzzi

Reputation: 495

Add the expand key-binding below in emmet to your .vimrc. You can use both <Tab> and <C-Y> to trigger emmet. More information can be found in the docs (:help emmet).

let g:user_emmet_expandabbr_key = '<Tab>'

Upvotes: 10

Vin&#237;cius Melo
Vin&#237;cius Melo

Reputation: 81

i'm using let g:user_emmet_leader_key='<A-e>'

use some special key (<C-e>, <A-e>...) or vim will wait for a emmet-vim command every time you type , or \

Upvotes: 0

Gianluca Casati
Gianluca Casati

Reputation: 3753

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.

Upvotes: 1

romainl
romainl

Reputation: 196586

: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.

Upvotes: 4

Related Questions