Hacker News new | ask | show | jobs
by tombert 3729 days ago
I'm a goober and have never once used the leader key...I guess I'm a bit of a noob.
1 comments

A leader key will expand the number of keys available to you. You can have maps like <leader>j that doesn't interfere with the default j map. There is also <localleader> that does the same thing. They're like having a sticky <ctrl> or <alt> but more comfortable. Read up on them (:h mapleader) and you will have more sun shine fun with Vim! For the record I use the comma as the <leader> key and leave <localleader> as the backslash since it's used rarely.
I started using ? as the leader (I don't do reverse searches). The other options (, \) always get in the way while programming. I might try the backtick, but it means that programming in languages that use backticks (Rust, I think) would be a pain.
The backtick is also used for for jumping to marks. I wouldn't recommend overriding that one. `. will put your cursor back to the last insertion point. '. will put you back on the last insertion line. They're quite handy. A common key that is used is <space>. There' is also using CAPSLOCK as a leader key, but it's not very portable since it requires configuring the OS. I think ? is fine for a leader key as long as you know that you're not going to use reverse search ever.

Looks like HN is slowing down the post speeds here. If you want to talk about Vim more, send me a message @cloudsiphon on Twitter.