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 e
s, 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.
Written by Chad Ostrowski
Related protips
2 Responses
To make that work, insert the space via 'Ctrl-V, <spacebar>' when changing the .vimrc file.
@sjashc or s
, or xi
, or any other command to edit text.