Skip to content

Instantly share code, notes, and snippets.

@wcomnisky
Created March 15, 2020 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wcomnisky/c7c5413cc5d124eab051db7cc1e5b510 to your computer and use it in GitHub Desktop.
Save wcomnisky/c7c5413cc5d124eab051db7cc1e5b510 to your computer and use it in GitHub Desktop.
Terminal shortcuts for Mac terminal
Source: https://coderwall.com/p/a8uxma/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment