Last Updated: February 25, 2016
·
1.055K
· bytespider

OSX shortcuts ⌥ + ← or → and ⌘ + ← or → in iTerm2

Following on from Oscar Godson's Jump Between Words https://coderwall.com/p/alz8na I started to investigate how to achieve these shortcuts in iTerm2, my terminal of choice.

I have to say once you start looking up the ANSI control escape sequences, its pretty easy to figure out. http://www.termsys.demon.co.uk/vtansi.htm

⌥ + ← and →

In iTerm2's preferences, Click profiles then select Keys from the tabs on the right.

Next click the plus symbol under the table and then press ⌥ + ←.
Select the action as "Send escape sequence".
Enter b.

Picture

For ⌥ + ←, repeat the previous steps but for the escape sequence, enter f.

Picture

⌘ + ← and →

The process for ⌘ + ← and → is very much the same as ⌥ + ← and → however you use the escape sequence [H and [F for ⌥ + ← and ⌥ + → respectively.