Improving Vim for Macs with Touch Bars

My Love and Pain

I love me some Mac book. I was really happy when I purchased it. The new Macbooks at the time were ones with this new fancy Touch Bar. Seemed a bit gimmicky to me, but I thought whatever, I’ll give it a shot.

It didn’t take long for me to get frustrated. I soon came to the following conclusion:

the Touch Bar is the horrible. I miss my ESC key

Okay so the Touch Bar isn’t terrible but it wasn’t for me. The AwesomeWM was my window manager of choice way back when. The keyboard was my friend! Mice was for chumps.

A Quick Fix

So I started going back through my .dotfiles from when I was a Student Developer. One of us had a quick way to get out of insert mode w/o using the Escape key.

"This is the most necessary thing ever. Who has time to hit ESC?!
inoremap jj <ESC>l

I don’t remember exactly how this started, but usually when one of us found something cool, we all started using it.

Short Explanation

The inoremap funciton maps the first argument with the second argument but only while in insert-mode. In this case, jj will do the same as <ESC>l. Why add the l? Because I got into the habit of wanting my cursor where I left it.

A Little Something for Atom Users

I started using Atom for some projects and with vim-mode-plus. But I found myself CONSTANTLY writing something like:

System.out.println("dave rocks");jj:wq

That jj:wq snippet would be written EVERY TIME I would finish a thought or a line of code. Muscle memory is a powerful thing…

Rather than recondition myself, I decided to add my own Keymap into the config.

'atom-text-editor.vim-mode-plus.insert-mode':
  'j j': 'vim-mode-plus:activate-normal-mode'

'atom-text-editor.vim-mode-plus:not(.insert-mode)':
  ': w': 'core:save'

Comments