Tmux, Iterm2 And Meta Keys
In September, someone posted on reddit about not being able to get his Tmux configuration work when SSHing into Ubuntu 10.04 from a Mac running iTerm2.
The source of the problem is iTerm2 sending \e[1;9A - \e[1;9D for ⌥ + arrow keys. I asked @gnachman why iTerm2 sends \e[1;9A - \e[1;9D and not \e[1;3A - \e[1;3D and he answered 9 was inherited from the old iTerm (see the conversation on Twitter).
To complicate things further, tmux up to version 1.8 used to remap \e[1;9A - \e[1;9D to \e[\e[A - \e[\e[D. Then tmux 1.9 and 1.9a stopped doing so while tmux master branch does it again after commit 193b6bcf36dda3754c99beb0dcc3dfdfceebdb09.
From there you have several options:
- make iTerm2 send
\e[1;3A-\e[1;3Dby remapping keys in your profile

- make iTerm2 send
\e[1;3A-\e[1;3Dby running iTerm2 nightly starting from Build 2.9.20140911 and using the new advanced “Treat Option as Meta in escape codes send by typing arrow keys” option

-
let iTerm2 send
\e[1;9A-\e[1;9Dand let tmux know aboutkUP3,kDN3,kRIT3andkLFT3values -
let iTerm2 send
\e[1;9A-\e[1;9Dand run tmuxHEADe.g. by installing it withbrew install --HEAD tmux
Hope that helps!