Using the Macbook Pro Touchbar as a developer

As soon as I bought the 2018 Macbook Pro, countless friends told me about how annoying the touch bar was and how it seriously hindered development. At the time, I thought that they simply lacked imagination, or at least hoped that they did because I didn’t want the single most expensive item I have ever bought to be a disappointment. Luckily, I was right!

How to use the touch bar properly

The first thing you need to do is download iterm2. Once you have this, you need to make two modifications. I assume you use vim, if you don’t, why are you even complaining about the lack of ESC button? Anyway, It’s a bit annoying if you have to use the touch bar escape button all the time so we will remap CAPS to ESC. This is an good modification because the CAPS button is pointless.

  1. Open Settings
  2. Go to Keyboard
  3. Click modifier keys
  4. Change Capslocks to ESC.

Now, start using vim! But write down the commands you use a lot. For me, I use gg=G, :make, :vsp loads so what we are going to do is add shortcuts to the touchbar in iTerm2. Open preferences and head to Keys. You can use the button ‘Add Touchbar Item’ to add a new key mapping. Set the key mapping action to ‘Send Text with “vim” Special Chars’ Then type the command into the box. It may help to start the command with ‘\e’ (to send an escape keypress) and end with ‘\n’ (so send an enter keypress).

Now, restart iterm2. In the menu, go to view -> Customize TouchBar. Now you can use the mouse to drag your new vim shortcuts to the touchbar.