karmanebula.com/technically-borked/2013/12/16/leader-key-as-space-capslock-as...

I have many time seen people remap their CapsLock key to either Esc or Ctrl.

I prefer to use my leader key as a substitute for Ctrl-based commands. Perhaps I have spent so much time on Mac that pressing the Ctrl key for things feels unnatural vs. the Command key; in the last year my favorite environment has become Linux, as close to full-time as possible, so I may be slowly losing this preference. Either way that little stretch my pinky has to do to reach for the Ctrl key doesn't feel perfectly natural to me.

When I discovered the leader key, that was my solution.

Now, I have my CapsLock key remapped to Esc, and instead of using Ctrl all the time my spacebar is my leader key in normal mode. I love it because:

* It requires no finger stretching
* It can be easily hit by either hand at any time
* It’s as effective as Ctrl because rolling <Leader><other key> is just
  as quick for me as pressing <C-other key>, and because I can do the
  space with either hand it doesn’t matter which other key I press.
  Most keys are feel equally accessible so long as they’re near the
  home row.
* By having CapsLock mapped to Esc I'm a quick flick of the finger from
  my entire leader key library.
* I've effectively lost the need for nearly all Ctrl-based commands,
  except in rare occasions.

This final bullet makes it much easier, for me at least, to use my entire keyboard as a leader key-based set of custom shortcuts, which I think was the intention of the leader key in the first place, if I understand it correclty.

Here's my leader key-based .vimrc with my own shortcuts for extremely common tasks like moving and resizing buffer windows, opening split views, and saving buffers to disk:

let mapleader=" " nnoremap q :q nnoremap w :w nnoremap e :e nnoremap v :vsplit nnoremap s :split nnoremap p :CtrlP nnoremap g :vimgrep nnoremap c :copen nnoremap C :cclose nnoremap 8 :set tw=80 nnoremap 0 :set tw=0 nnoremap n :set invnumber nnoremap
nnoremap h h nnoremap j j nnoremap k k nnoremap l l

nnoremap H H nnoremap J J nnoremap K K nnoremap L L

nnoremap , 2< nnoremap . 2> nnoremap - 2- nnoremap = 2+


Comments (0)

Sign in to post comments.