So ctrl page up and down are all the rage nowadays, and I'd like to be able to C-p and C-n in gnu screen when I hit ctrl-pgup and down. I've tried and tried but the documentation is a little thin. Any ideas?
A controlpageup depends upon the particular terminal, but most of the ones you are interested in copy one of the flavors from xterm. Those look like
or in terminfo format
That is 6 characters.
However, screen (see 14.1 The bind command from screen's manual) says that it only knows how to bind a single character.
So the answer is: you cannot do that with screen.
It turns out you can do it. I finally figured it out.
With the help of this...
I add this to
bindkey -t ^[[5;7~ prev bindkey -t ^[[6;7~ next
and that gets me Ctrl + Alt + PageUp/Down moves between screen tabs.
You can define it easily using the
bindkey -t <key-code> <command>
For switching to the previous and next window, use commands
The key code for PageDown is
^[[5~ and PageUp
^[[6~, so to switch windows using those two keys, use the following to your
bindkey -t ^[[5~ prev bindkey -t ^[[6~ next
To add the Ctrl modifier, add
;5 to the key code:
bindkey -t ^[[5;5~ prev bindkey -t ^[[6;5~ next
For the Alt modifier, add
;3 and for Ctrl + Alt, add
-t parameter disables the timer so there may be a time gap between presses of the individual keys.
It's possible that on different systems or terminals, key codes may differ. Use
showkey -a to find out the exact codes.