Live data from Hacker News

Vim: Spacebar as leader key, CapsLock as Esc

karmanebula.com

31–40 of 44 posts

Re: Vim: Spacebar as leader key, CapsLock as Esc

#31
post #2

What is a leader key? How much typing class did I miss?!

I think he means instead of using a colon to begin Vim commands, he begins by typing a space. I started using Caps Lock as an extra Ctrl a couple months ago. It's great, except now I can't use other people's computers because I end up in caps-lock shout mode. E.g. instead of "ctrl+l" in my browser to visit a site, it ends up: CTRL+SHOUT+L BROWSER TAKE ME TO FACEBOOK I COMMAND THEE

colon is used to enter Ex mode. Leader is a separate key (used as an extra modifier like the Meta key in Emacs) http://stackoverflow.com/questions/1764263/what-is-the-leade...

Re: Vim: Spacebar as leader key, CapsLock as Esc

#32
I end up using Ctrl for a bunch in vim: visual block, ctrlp (and for buffer mode), window nav, and most importantly, imported emacs keybindings. The emacs line motion commands (specifically , , and ) are extremely useful because they work in every app on my mac, so not having to lose flow when I'm in vim or a browser is nice.

https://github.com/CGamesPlay/dotfiles/blob/master/files/vim...

Re: Vim: Spacebar as leader key, CapsLock as Esc

#33
Why not map caps lock key to both escape AND control? I've been doing this successfully for a long time and couldn't live without it. You can use Autohotkey on windows and similar tools on other systems to interpret caps lock pressed by itself as escape, and caps lock pressed + another key as control.

Re: Vim: Spacebar as leader key, CapsLock as Esc

#37

I basically do this, but I use "," (comma) as my leader, and I make capslock do double duty as ctrl and esc using KeyRemap4MacBook ( https://pqrs.org/macosx/keyremap4macbook/ ). The trick is first remap capslock to Ctrl in keyboard system preferences, then use KR4MB to remap Control_L (the left control key, which is to say, what capslock now signals) to Control_L, but if you type ONLY Ctrl_L it sends esc. so when i n…

For linux people, this can be accomplished with: https://github.com/cmatheson/super-caps

That said, I don't use this anymore because I found that I rarely release escape (er, caps lock) before moving on to the next key. So I was getting a lot of control-n instead of n.

Re: Vim: Spacebar as leader key, CapsLock as Esc

#39
I broke things down by priority. I notice that I jump around in documents by searching through them, rather than by navigation keys. Spacebar is the biggest key on the keyboard, so, spacebar is mapped to "?" in normal mode. I also find that I need to search through a project regularly, so ctrl-spacebar is mapped to the ack/ag command.

Control is mapped to caps lock at the os level for me. There are also too many useful commands in vim that use control (visual block mode is huge). I tried mapping jj to escape as well, but ctrl-c is just as easy.

Leader is mapped to comma. Most of my leader commands are comma + "some letter I can type with my left hand".

Re: Vim: Spacebar as leader key, CapsLock as Esc

#40

I broke things down by priority. I notice that I jump around in documents by searching through them, rather than by navigation keys. Spacebar is the biggest key on the keyboard, so, spacebar is mapped to "?" in normal mode. I also find that I need to search through a project regularly, so ctrl-spacebar is mapped to the ack/ag command. Control is mapped to caps lock at the os level for me. There are also too many usef…

> I jump around in documents by searching through them

You might want to try vim-sneak.

https://github.com/justinmk/vim-sneak

Post reply on HN