简体   繁体   中英

Vim leader key mapping for zR?

I've created many leader key mappings in my .vimrc file for commands that you enter after typing ":". 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? 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. So for example, I have Ctrl - ^ mapped to leader 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. You don't need a <CR> because you don't need one when typing the command in normal mode either.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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