Vim tip: map leader to space!

Posted on

Lots of people I know map their <leader> key to ,. This seems like a good idea until you learn the comma’s expected use:

When you fe to find the next e on a line, you can hit ; to move to each next occurrence of e. But if a line has lots of es, I often ; too many times.

To move to the PREVIOUS e, I need to press ,. Handy!

…unless I mapped my <leader> key to ,! Then I basically broke that functionality.

Instead, try mapping <leader> to space!

mapleader=" "

I never use space in my normal vimming at this point. It behaves like l, but also moves from the end of one line to the beginning of the next (l gets stuck at line-ends). Maybe someday I’ll find some brilliant use of space that makes me wonder how I lived without it (like , right now), but for now it seems sorta pointless.

Leave a Reply

Your email address will not be published. Required fields are marked *