tmux / screen ctrl+arrow (left right) doesn't work on SSH

SagiLow

I've configured tmux to skip words on Ctrl+right / left :

set-window-option -g xterm-keys on

It works just fine, but as I do SSH, it doesn't work and prints ;5D or ;5C..

The same issue occurred when I used screen, is there some specific configuration for tmux/screen on SSH ?

user1686

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):

  1. 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.

  2. In man bash, find the inputrc ("readline") command for skipping a word. (It's forward-word.)

  3. In ~/.inputrc, add both the key sequence and the command. (The "ESC" is written as \e.)

    "\e[1;5C": forward-word
    
  4. Repeat the same for Ctrl.

  5. Close ssh, then connect again and see if it works.

Note that most distributions already have these particular mappings in /etc/inputrc.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Left Ctrl Key doesn't work (but right one does)

From Dev

tmux doesn't passes correctly ctrl-shift-arrow sequences

From Dev

Octal code for "Ctrl + left arrow" and "Ctrl + right arrow"

From Dev

box shadow to left and right doesn't work

From Dev

solaris ssh ctrl arrow keys do not work

From Dev

right and left arrow keys does not work for me

From Dev

Ctrl+z and fg with SSH - why doesn't it work?

From Java

CSS Transition doesn't work with top, bottom, left, right

From Dev

setMargins(left, top, right, bottom); Android doesn't work

From Dev

overflow:hidden doesn't work on .animate() to the left, but works to the right?

From Dev

Remote Desktop: Sending Ctrl-Alt-Left Arrow/Ctrl-Alt-Right Arrow to the remote PC

From Dev

Toolbar doesn't flip the custom navigation icon arrow when switching to right-to-left layouts(Arabic)

From Dev

Tmux commands doesn't work

From Dev

Resize terminal emulator windows with ctrl+super+arrow doesn't work any more

From Dev

Ctrl + arrow keys working in tmux

From Dev

Attaching an event listener for left or right click - onclick doesn't work for right click

From Dev

mouse right click/left click/scroll don't work in the middle of the screen

From Java

IntelliJ Idea Ctrl+Alt+Left shortcut doesn't work in Ubuntu

From Dev

float right doesn't work

From Dev

LEFT JOIN doesn't work

From Dev

tmux set-titles doesn't work?

From Dev

Why doesn't gsettings work in tmux?

From Dev

Use Ctrl + Left/Right to move forward/back one word in tmux within Mobaxterm

From Dev

How can I make ctrl+left/right keys to move by whole word in tmux?

From Dev

ignoring text height using float left doesn't work but right does

From Dev

If I hold down the left or right mouse button, mouseenter doesn't work

From Dev

Synergy doesn't work correctly if I switch client/server role (left of works, right of does not)

From Dev

If I hold down the left or right mouse button, mouseenter doesn't work

From Dev

ms word find/replace highlighted text, doesn't work on this mix of hebrew and english in right to left mode

Related Related

  1. 1

    Left Ctrl Key doesn't work (but right one does)

  2. 2

    tmux doesn't passes correctly ctrl-shift-arrow sequences

  3. 3

    Octal code for "Ctrl + left arrow" and "Ctrl + right arrow"

  4. 4

    box shadow to left and right doesn't work

  5. 5

    solaris ssh ctrl arrow keys do not work

  6. 6

    right and left arrow keys does not work for me

  7. 7

    Ctrl+z and fg with SSH - why doesn't it work?

  8. 8

    CSS Transition doesn't work with top, bottom, left, right

  9. 9

    setMargins(left, top, right, bottom); Android doesn't work

  10. 10

    overflow:hidden doesn't work on .animate() to the left, but works to the right?

  11. 11

    Remote Desktop: Sending Ctrl-Alt-Left Arrow/Ctrl-Alt-Right Arrow to the remote PC

  12. 12

    Toolbar doesn't flip the custom navigation icon arrow when switching to right-to-left layouts(Arabic)

  13. 13

    Tmux commands doesn't work

  14. 14

    Resize terminal emulator windows with ctrl+super+arrow doesn't work any more

  15. 15

    Ctrl + arrow keys working in tmux

  16. 16

    Attaching an event listener for left or right click - onclick doesn't work for right click

  17. 17

    mouse right click/left click/scroll don't work in the middle of the screen

  18. 18

    IntelliJ Idea Ctrl+Alt+Left shortcut doesn't work in Ubuntu

  19. 19

    float right doesn't work

  20. 20

    LEFT JOIN doesn't work

  21. 21

    tmux set-titles doesn't work?

  22. 22

    Why doesn't gsettings work in tmux?

  23. 23

    Use Ctrl + Left/Right to move forward/back one word in tmux within Mobaxterm

  24. 24

    How can I make ctrl+left/right keys to move by whole word in tmux?

  25. 25

    ignoring text height using float left doesn't work but right does

  26. 26

    If I hold down the left or right mouse button, mouseenter doesn't work

  27. 27

    Synergy doesn't work correctly if I switch client/server role (left of works, right of does not)

  28. 28

    If I hold down the left or right mouse button, mouseenter doesn't work

  29. 29

    ms word find/replace highlighted text, doesn't work on this mix of hebrew and english in right to left mode

HotTag

Archive