:bind will not accept weird virtual characters like the arrow-keys — only keypresses that have ASCII-codes or stuff like ctrlthingThatHasAsciiCode — I think using
:bindkey is the simplest way to get what you're after. For me, the following worked under GNU screen 4.06.01 in xterm and could be added either into "~/.screenrc" (affects just you) or "/etc/screenrc" (meant to apply system-wide):
# ctrlA then right-arrow-key jumps active cursor one pane to the right:
bindkey "^A^[OC" focus right
# ctrlA then left-arrow-key jumps active cursor one pane to the left:
bindkey "^A^[OD" focus left
# ctrlA then up-arrow-key jumps active cursor one pane above current:
bindkey "^A^[OA" focus up
# ctrlA then up-arrow-key jumps active cursor one pane below current:
bindkey "^A^[OB" focus down
Depending on your terminal and settings, the codes you need to place after the "^A" may be different for you. To determine what these codes are, I prefer to use
vim; open it and then press i to enter edit-mode, then press ctrlv to take raw input, then hit the key or key-combination in question * **.
When you use my approach, you'll need to type your ctrlarrowKey command fairly swiftly;
screen stops listening for custom bindings if you pause for too long between keystrokes. If it's expiring too quickly, use
:bindkey -t instead of
:bindkey to disable the timer.
* Note that unlike in
vim, screen will not like it if you insert the actual metacharacter escapes into ".screenrc" or other files you might source; simply use literal, individual '^' and '[', not the weird combined version that
vim can output (at least, that seemed to screw things up for me).
** Some people determine special key-codes by running
cat (by itself) in the terminal, and then pressing the key(s) in question (before using ctrlc to quit). I don't use this approach so YMMV.