It's not tmux nor screen that "skips words"; the text input is provided by your shell. You must therefore find out what key sequence Ctrl+arrows generate, and teach your shell that it means "skip a word". Otherwise, it will stop interpreting mid-sequence because it's not recognized.
If you're using bash, it takes some of the key definitions from ncurses/terminfo, and others from the "inputrc" file. So first make sure you have the ncurses terminal definitions installed ("ncurses-term" or similar). And if you have a custom ~/.inputrc
, tell it to import the system-wide one, using:
$include /etc/inputrc
If that doesn't help, add a custom mapping to your ~/.inputrc file (on the server, of course):
In bash, press CtrlV (the "verbatim input" key), followed by Ctrl→. You'll see the "Ctrl+right" escape sequence inserted as plain text:
^[[1;5C
The ^[
means an "ESC" character; the rest are plain text. So this is ESC [ 1 ; 5 C
.
In man bash
, find the inputrc ("readline") command for skipping a word. (It's forward-word
.)
In ~/.inputrc
, add both the key sequence and the command. (The "ESC" is written as \e
.)
"\e[1;5C": forward-word
Repeat the same for Ctrl←.
Close ssh, then connect again and see if it works.
Note that most distributions already have these particular mappings in /etc/inputrc
.