Despite being a Mac-only product, the terminal replacement iTerm2 defaults to using very un-Mac-like shortcut keys. Fortunately, this is easily remedied.
Earlier today I updated my configs repo on GitHub to add the settings I use for the OSX terminal replacement iTerm2. When I installed iTerm2 I left many of the settings unchanged from their presets but one section I immediately updated was the global shortcut keys. These are initially set to reflect the illogical, outdated and downright bizarre shortcuts used in the editors of yesteryear – Vi and Emacs – and I wanted them to behave more like the standard OSX shortcuts. Thankfully, iTerm2 makes this very easy to do.
The shortcuts can be configured in the Keys section of the preferences (accessed via the iTerm… Preferences menu item). Below are my updated settings:
Only 7 key combinations were changed:
- ⇧⌘↑ became Scroll One Page Up
- ⇧⌘↓ became Scroll One Page Down
- ⌃⌘↓ became Scroll To End
- ⌥← became Send ^[ b i.e. Move Cursor Left One Word
- ⌘← became Send Hex Codes: 0x01 i.e. Move Cursor To Start Of Line
- ⌥→ became Send ^[ f i.e. Move Cursor Right One Word
- ⌘→ became Send Hex Codes: 0x05 i.e. Move Cursor To End Of Line
Shortcuts are redefined by double-clicking on the entry then selecting the new action to be applied. In most cases you simply want to chose a predefined action such as Scroll to End:
though for Move Cursor To Start Of Line and Move Cursor To End Of Line you should chose Send Hex Code as the action and enter the appropriate code (0x01 for start of line and ox05 for end of line):
Similarly, for Move Cursor Left One Word and Move Cursor Right One Word you should chose the Send Escape Sequence action and enter the appropriate code (b for left one word and f for right one word):
After closing the preferences dialog your new shortcuts will be available for use.