简体   繁体   English

用于zR的Vim领导者密钥映射?

[英]Vim leader key mapping for zR?

I've created many leader key mappings in my .vimrc file for commands that you enter after typing ":". 我在.vimrc文件中为键入“:”后输入的命令创建了许多领导者键映射。 For example, 例如,

map <Leader>sw :StripWhitespace<CR>

But how do you create a leader key mapping in .vimrc for a command that you like "zR" which opens all folds? 但是,如何在.vimrc中为您喜欢的“ zR”命令打开所有折叠的领导者映射键呢? This isn't a command that you would type ":" before entering it. 这不是您要在输入前键入“:”的命令。

You create it in much the same way: leader combination, followed by the key combination you want it to map to. 您可以通过几乎相同的方式创建它:领导者组合,然后是您要映射到的组合键。 There's nothing particularly special about the ex command mappings. ex命令映射没有什么特别的。 So for example, I have Ctrl - ^ mapped to leader p : 因此,例如,我已将Ctrl- ^映射到首长 p

map <Leader>p <C-^>

because it's a particularly annoying combination to reach on my split keyboard. 因为这是我拆分键盘上特别烦人的组合。 In your case, I imagine you'd use: 就您而言,我想您会使用:

map <Leader>ff zR

Obviously, f f is just an example binding. 显然, f f只是一个示例绑定。 You don't need a <CR> because you don't need one when typing the command in normal mode either. 您不需要<CR>因为在正常模式下键入命令时也不需要。

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

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