I just found that tmux seems to expect xterm keycodes, not minding the
screen terminal type. Hence I just punched the keys in xterm, using Ctrl-V as a prefix and got these codes:
- left key:
- right key:
- up key:
- down key:
I can now configure OS X terminal to send those key codes, and tmux works fine. However, other apps running in tmux will break, because they don't expect to get xterm key codes. I found a workaround in the ArchWiki, which suggests to create your own terminfo entry. I will try that.
Edit: The tmux FAQ got me going, and I added the following two lines to my
set -g default-terminal "xterm-256color"
setw -g xterm-keys on
Now I can use C-arrows in tmux, bash, emacs and other programs.
One more edit: Since tmux does not support bce (background color erasing), I needed to make my own terminfo, called xterm-256color-nobce:
infocmp xterm-256color | sed 's/bce, //' > xterm-256color-nobce
sudo tic ./xterm-256color-nobce
And made sure to use that as my default TERM value.