Making iTerm 2 work with normal Mac OSX keyboard shortcuts

Today I found out how to map common Mac keyboard shortcuts to work like they should inside iTerm. The ones that I needed most where ⌥← (Option-Left Arrow) to move left one word, ⌥→ (Option-Right Arrow) to move right one word, ⌘← (Command-Left Arrow) to move to the beginning of the line and ⌘→ (Command-Right Arrow) to move to the end of the line.

The process is very simple, you just have to add a few shortcut keys to your profile. Here are the screenshots.

Keyboard Shortcut: ⌥←
Action: Send Escape Sequence
Esc+ b

Keyboard Shortcut: ⌥→
Action: Send Escape Sequence
Esc+ f

Keyboard Shortcut: ⌘←
Action: Send Escape Sequence
Esc+ [H

Keyboard Shortcut: ⌘→
Action: Send Escape Sequence
Esc+ [F

delete-line

Keyboard Shortcut: ⌘←Delete
Action: Send Hex Code
0x15

delete-word

Keyboard Shortcut:⌥←Delete
Action: Send Hex Code
0x1B 0x08

 

20 thoughts on “Making iTerm 2 work with normal Mac OSX keyboard shortcuts”

  1. … Great thanks! Any idea the purpose behind not setting this by default? (What do [D/[C mean or do?

  2. I don’t know why iTerm2 doesn’t do this properly out of the box! Thanks so much for helping me configure my instance!

Leave a Reply