默认情况下, <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.
请注意,当您按<leader>键时, 您只有 1000 毫秒 (默认情况下) 输入后面的命令 。
这会加剧,因为没有视觉反馈(默认情况下)你已按下<leader>键并且 vim 正在等待命令; 所以也没有直观的方法来知道这个时间何时发生。
如果你将set showcmd添加到你的vimrc那么你会看到你的<leader>键出现在 vim 的右下角(光标位置的左侧),也许更重要的是你会看到它在超时发生时消失 。
也可以在vimrc设置超时的长度,有关详细信息,请参阅:help timeoutlen 。
“领导者密钥” 是一种通过使用密钥序列来执行命令来扩展 VIM 快捷方式的功能的方法。默认的 leader 键是反斜杠。因此,如果您有