zsh + iTerm2 OSX shortcuts
We all love OSX built-in shortcuts
⌥ + ← or → - move one word backward/forward
⌘ + ← or → - move to beginning/end of line
In zsh you can use ctrl + a/e to move to beginning/end of line and esc + W/B to move one word backward/forward, but that's not very handy.
Here is a solution to map ⌥ + ← / → and ⌘ + ← / → to work in iTerm2 as expected
Put this in your .zshrc
bindkey "[D" backward-word
bindkey "[C" forward-word
bindkey "^[a" beginning-of-line
bindkey "^[e" end-of-line
Then open iTerm2 preferences and set
You have to choose "Send escape sequence" action and put there only "a" or "e".
PROFIT!
Written by Tymon Tobolski
Related protips
1 Response
thank you very much for this. The goto beginning of line and end of line works just perfect with this however to move from words I have to put like this:
bindkey "\e\e[D" backward-word
bindkey "\e\e[C" forward-word
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#