Vim Keyboard Navigation In OS X

Whilst I am a little frustrated by TextMate's lack of modernisation (TextMate 2??), it's really not such a bad piece of software. Doubly so when its what your familiar with! However, like many TM users with a solid knowledge of the editor I've reached a point where I'm thinking "I want to learn more. I've reached my productivity plato, what now?". For many the answer seems to lie in the infinitely customisable and wonderfully powerful Vim. Thus the reason for my desire to learn Vim was born. I confess I've not made the switch yet, I do try now and again and shall keep doing so but I'm not there yet. There is however one thing I have been sold on since day one. The kind of thing you learn about and think yes, this is how I should have been doing it all these years.

h,j,k,l

Take a look at the picture below and prepare to be educated.

ADM3A terminal keyboard layout

Have you seen it? Surely you noticed it? The arrow keys are situated on the h,j,k,l keys! This is great because you don't have to move your right hand four inches every time you want to move your cursor (please don't tell me you use the mouse). If you don't understand why this is great, chances are you aren't a touch typist. The ADM3A terminal let you navigate without moving your fingers from the home row simply by means of a modifier key. If only this ancient technology could be applied to OS X system wide.

Applying this ancient technology to OS X system wide

Fortunately for you theres a paragraph here that explains how to do just that! You'll need a helper application, something that can map keyboard macros to keyboard shortcuts. Why not use the free Spark? Go on a give a download. Then you can go about setting up a few Vim navigational shortcuts. How is this going to work? The list below will explain all:

  • ⌥⇧4 ~ Move to end of line ~ ⌘⇢
  • ⌥⇧6 ~ Move to start of line ~ ⌘⇠
  • ⌥B ~ Move backwards a word ~ ⌥⇠
  • ⌥⇧B ~ Select backwards a word ~ ⌥⇧⇠
  • ⌥H ~ Move left ~ ⇠
  • ⌥⇧H ~ Select left ~ ⇧⇠
  • ⌥J ~ Move down ~ ⇣
  • ⌥⇧J ~ Select down ~ ⇧⇣
  • ⌥K ~ Move up ~ ⇡
  • ⌥⇧K ~ Select Up ~ ⇧⇡
  • ⌥L ~ Move Right ~ ⇢
  • ⌥⇧L ~ Select Right ~ ⇧⇢
  • ⌥W ~ Move forward a word ~ ⌥⇢
  • ⌥⇧W ~ Select forward a word ~ ⌥⇧⇢

The first part is the keyboard shortcut we use, followed by a textual description of the action and finally the keyboard key(s) it emulates. This is all incredibly easy to set up in Spark but since I'm extra kind I'm going to go ahead and share my Spark library for you to import if you wish.

Enjoy navigating around OSX vim style! (Well as close as you can get without a modal option)