Neat trick for Vim keybindings

I actually found this out while looking at another person’s vimrc while looking for some good Unite config, cause I’m not really comfortable with advanced VimL, which Unite for sure uses.

The specific lines are these:

This gave me an awesome hint, which is that you can actually set a key blank so that by itself it does nothing but with an extra key it does something. In this case it’s the space key. And also that you could alias a key to another value.

So now I use it like this in my vimrc (changes I haven’t pushed yet though, at the time of writing):

nm <space> [space]
nn [space] <NOP>

And a lot of my filesystem and buffer plugins use these keybinds. I may even set it up eventually so that it completely replaces my leader key, which I honestly don’t use much anyway, nowadays.


Posted a question on StackOverflow and it seems it’s nothing too special. Still a neat trick though:

May 23, 2014