Macify your iTerm keybindings

iTerm is an amazing terminal application. Even though it doesn't natively support every Mac-like shortcut, we can tell it how we like it.

There are a set of common controls (move the cursor between words, move between lines, deleting entire lines) when working with bash or zsh that I need constantly. The standard bindings are not habitual for me and while it would be easy enough to learn. Having said that, I feel keeping consistant shortcuts across apps is so good for OS X that these shoudl be the same.

So instead of learning a few new bindings let's make iTerm work like all your other Mac OS X applications.

  • Move left between words ⌥← | send escape sequence | b
  • Move right between words ⌥→ | send escapes sequence | f
  • Start of the line ⌘← | send escape sequence | [H
  • End of the line ⌘→ | send escape sequence | [F
  • Delete previous word ⌥←Delete | send hex code | 0x1B 0x08
  • Delete entire line ⌘←Delete | send hex code | 0x15

In case you're the same as me looking at the amazing choice of icons in OS X, ⌘ = command and ⌥ = options/alt (why oh why?).