简体   繁体   English

在 Vim 中更改 emmet 的领导键

[英]Change emmet's leader key in Vim

Is it possible to to change the way you expand emmet code into HTML?是否可以更改将 emmet 代码扩展为 HTML 的方式?

The default is ctrl+y+, and thats about two too many keys for my liking.默认是 ctrl+y+,这对我来说大约有两个太多的键。

In sublime I just enter the emmet code and hit tab and it expands it.在 sublime 中,我只需输入 emmet 代码并点击选项卡,它就会展开它。 Is there a way to have it do this vim?有没有办法让它做这个vim?

也许您应该.vimrc添加到您的.vimrc

let g:user_emmet_expandabbr_key = '<Tab>'

:help emmet-customize explains how to customize Emmet's mappings. :help emmet-customize解释了如何自定义 Emmet 的映射。 As a "noob", you owe it to yourself to get used to Vim's documentation.作为一个“菜鸟”,你应该习惯于 Vim 的文档。

You could add the line below to ~/.vimr/after/ftplugin/html.vim :您可以~/.vimr/after/ftplugin/html.vim添加到~/.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", <Cy> so I'm not sure it is a good idea to take the direction you want to take.然而,Emmet 有很多功能可以通过许多映射访问,所有映射都使用相同的“领导者”, <Cy>所以我不确定采取你想要采取的方向是个好主意。

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.例如,如果我输入div或任何其他 emmet 表达式,那么我只需输入,,即可完成。

i'm using let g:user_emmet_leader_key='<Ae>'我正在使用let g:user_emmet_leader_key='<Ae>'

use some special key ( <Ce> , <Ae> ...) or vim will wait for a emmet-vim command every time you type , or \\使用一些特殊的键 ( <Ce> , <Ae> ...) 否则 vim 每次输入时都会等待 emmet-vim 命令,或者 \\

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM