I can see that Ctrl+left/right jumps to the beginning/end of line. How to change this to Cmd+left/right arrow?
In order to get Alt+left/right arrow working correctly for word jumping follow this article.
I can see that Ctrl+left/right jumps to the beginning/end of line. How to change this to Cmd+left/right arrow?
In order to get Alt+left/right arrow working correctly for word jumping follow this article.
To jump between words and start/end of lines in iTerm2 follow these steps:
Move cursor one word left
0x1b 0x62
Move cursor one word right
0x1b 0x66
Move cursor to beginning of line
0x01
Move cursor to end of line
0x05
Delete word
0x1b 0x08
Delete line
0x15
Undo
0x1f
Don't forget to remove the previous bindings:
For quick reference of anyone who wants to go to the end of line or start of line in iTerm2, the above link http://hackaddict.blogspot.com/2007/07/skip-to-next-or-previous-word-in-iterm.html notes that in iTerm2:
In iTerm 3.0.12 you can switch to
Natural Text Editing
preset:Warning As it is a preset, it can override the keys you have binded before. So it's better to save your current key bindings before applying a preset.
Just to help out anyone that is having the same issue but specifically using Zsh shell with iTerm 2. It turns out that Zsh doesn't read
/etc/inputrc
properly, and so fails to understand any key bindings you set up through the preferences!To fix this, you need to add some key bindings to your
.zshrc
file, such as:Note the backslashes in the example above before the "e", the linked article does not show them, so add them into your
.zshrc
file when adding bindings.The old fashion emacs bindings can still work in iterm2 and os x terminal:
Preferences -> Profiles -> Keys (sub tab in profiles)
Left/Right option <kbd>⌥</kbd> key acts as +Esc
(similar in os x terminal)This should enable alt-f and alt-b for moving words by words. (Still ctrl-a and ctrl-e always work as usual)
If set as
meta
those old bindings will work while some iterm2 bindings unavailable.Follow the tutorial you listed above for setting up your key preferences in iterm2.
OR