I have following custom zsh keybindings for the alt (meta) + left and right arrow key withi os x Iterm2 and +Esc setting for meta

bindkey "^[^[[D" backward-word
bindkey "^[^[[C" forward-word

This allows to jump by word on the shell like in most gui text editors with alt arrow.

However when starting tmux session those bindings just print following on the screen.


Any idea how to make zsh within tmux accept the bindings.

3 Answers 3


Escape indicates meta only for combinations of the form Meta+c where c is a printable character or a control character. Most terminals do not prepend an escape character to escape sequences, so that you can type two consecutive escape characters to trigger the Escape binding in applications, and so that escape sequences do not contain control characters after the initial escape character.

To see what escape sequence your terminal sends for a keystroke, press Ctrl+V then that keystroke, e.g. Ctrl+V then Meta+Left, at a shell prompt or in cat. In a terminal in cooked mode and in applications such as shells and Vi, Ctrl+V means “insert the next character literally even if it is a control character”, thus Ctrl+V followed by a keystroke that sends an escape sequence results in inserting that escape sequence (assuming that the escape sequence doesn't contain any control character apart from the leading escape character).

You'll probably see something like this:


meaning that Meta+Left sends the escape character followed by the three characters O1D. This means that you need the binding

bindkey "^[O1D" backward-word
  • the escape sequence i posted are printed like this in tmux and Iterm2 within cat. also other bindings work exactly the same in both. Just alt arrow is not working in tmux
    – dre-hh
    Commented Jul 9, 2018 at 7:24

Add set-option -g xterm-keys on to tmux.conf or enter :set-option -g xterm-keys on inside tmux everytime.

  • unfortunately that did no help
    – dre-hh
    Commented Jul 6, 2018 at 14:03

Since you mentioned you are using iTerm - please take a look at this answer:

Playing with bindkey settings didn't work for me and then I just deleted all of them and changed my iTerm setting as described in there and everything worked like a charm :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .