I use Terminal.app on OS X, and I want to bind ctrl-left/right to cycle through tmux windows (like I did with screen).
The tmux incantation is easy to find online:
bind-key -n C-Left prev
bind-key -n C-Right next
This doesn't work though, because Terminal.app is sending
^[[5D for left instead of what tmux expects. In my case, with
TERM=xterm-256color, tmux is expecting
^[[1;5D for C-Left and
^[[1;5C for C-Right. You can change this in the Terminal.app settings. Ideally Terminal.app would magically send the right values based on the
TERM setting, if there is such a thing as the right values in the world of terminfo and modified arrow keys.
I would prefer to tell tmux to accept
^[[5D instead of
^[[1;5D, which is what I did in my screen config, but I can't see any way to tell tmux to take a raw escape sequence instead of logical keys. I prefer that so that I don't have to remember (or research) magical incantations to configure Terminal.app the next time I start from scratch on OS X. So if you know how, let me know.
OS X's Termina.app is the terminal I've been using since I switched to Leopard, because it has tabs now and it's beautiful. Oh, and iTerm gave me too much grief with odd, illogical and unpredictable bugs.
One of the drawbacks to Terminal.app is that it's broken. This is what Aptitude looks like with
TERM=xterm (I think this is the default):
This is what it should look like:
How to get from there to here? The short answer is to choose
dtterm as your terminal emulation (in Preferences, on the Advanced tab).
The long answer is that the problem here is that xterm supports this capability called back-color-erase (bce). If you tell programs that you are an xterm (with
TERM=xterm), they will assume you support bce. The same goes for
xterm-color and even
vt100 (even though that one doesn't seem to support color). bce isn't the only problem, either. There's also redraw problems that are difficult to show with a screenshot.
TERM=dtterm seems to get rid of at least the major breakage. It would seem that the actual capabilities of Terminal.app are closest to dtterm, or at least closer to dtterm than to xterm or rxvt. It solves all the issues I've been having with aptitude, mutt, and screen locally and on remote linux boxes. But there's a caveat—not all remote systems will have the dtterm entry in their terminfo databases. Ubuntu 7.10 didn't by default, for example. The package you want on Debian-based systems (like Ubuntu) is
Alternatively, you can install it in your home directory. To do this, on OS X type
infocmp > /tmp/dtterm scp /tmp/dtterm email@example.com:/tmp ssh example.com tic /tmp/dtterm
tic (terminfo compiler) will create a terminfo database entry in
~/.terminfo/d/dtterm, and you should be good to go.