I am using tmux a lot, and I have already managed to tune my OS X terminal to send the correct key codes for Ctrl+left and right arrow (\033b and \033f). I found those information on the web. However, I also need Ctrl+up and down to work correctly. How do I find out which key codes tmux expects? The TERM variable is set to screen while inside of tmux. Can I query the terminal database on my Linux machine for the codes?At the moment, my OS X terminal simply sends arrow left and right, without the Ctrl modifier.
How do I find out the keycodes for Ctrl+up and down arrow for TERM=screen?
terminal;osx;keyboard;tmux
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: ^[[Dright key: ^[[Cup key: ^[[Adown key: ^[[BC-left: ^[[1;5DC-right: ^[[1;5CC-up: ^[[1;5AC-down: ^[[1;5BI 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 ~/.tmux.conf:set -g default-terminal xterm-256colorsetw -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-nobcesudo tic ./xterm-256color-nobceAnd made sure to use that as my default TERM value.