Last Updated: February 25, 2016
·
5.707K
· chadoh

Vim tip: map leader to space!

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.

2 Responses
Add your response

To make that work, insert the space via 'Ctrl-V, <spacebar>' when changing the .vimrc file.

over 1 year ago ·

@sjashc or s, or xi, or any other command to edit text.

over 1 year ago ·