我<leader>在许多.vimrc文件中看到,我想知道它是什么意思?它是干什么用的?只是对目的和用法的一般概述将是伟大的.
Ver*_*reb 916
该<Leader>键映射到\默认.因此,如果你有一张地图<Leader>t,你可以默认使用\+ 执行它t.有关更多详细信息或使用mapleader变量重新分配,请参阅
:帮助领导者
To define a mapping which uses the "mapleader" variable, the special string
"<Leader>" can be used. It is replaced with the string value of "mapleader".
If "mapleader" is not set or empty, a backslash is used instead.
Example:
:map <Leader>A oanother line <Esc>
Works like:
:map \A oanother line <Esc>
But after:
:let mapleader = ","
It works like:
:map ,A oanother line <Esc>
Note that the value of "mapleader" is used at the moment the mapping is
defined. Changing "mapleader" after that has no effect for already defined
mappings.
duk*_*ave 243
请注意,当您按下<leader>键时,您只有1000毫秒(默认情况下)输入后面的命令.
这会加剧,因为没有视觉反馈(默认情况下)你已按下你的<leader>键,而vim正在等待命令; 所以也没有直观的方法来知道这个时间何时发生.
如果你添加set showcmd到你的vimrc那么你将看到你的<leader>键出现在vim的右下角(光标位置的左侧),也许更重要的是,当超时发生时你会看到它消失.
也可以在您的设置中设置超时的长度vimrc,:help timeoutlen有关详细信息,请参阅.
Mik*_*age 108
"领导者密钥"是一种通过使用密钥序列来执行命令来扩展VIM快捷方式的功能的方法.默认的leader键是反斜杠.因此,如果您有<Leader> Q的地图,则可以通过键入\ Q来执行该操作.
Pet*_*tte 85
Vim的<leader>关键是为要定义的命令创建命名空间.Vim已经映射了大多数键和Ctrl+(某些键)的组合,因此<leader>(some key)您(或插件)可以添加自定义行为.
例如,如果您发现自己经常删除正好3个单词和7个字符,您可能会发现通过映射命令很方便nmap <leader>d 3dw7x,按下引导键后跟d将删除3个单词和7个字符.因为它使用领导者密钥作为前缀,所以您可以(相对)确保您不会踩到任何预先存在的行为.
默认密钥为<leader>is \,但您可以使用该命令:let mapleader = ","将其重新映射到另一个密钥(,在本例中).
关于领导者密钥的Usevim页面有更多信息.