tmux + micro text editor: shift-arrow echo keycode

Viewed 345

Ubuntu 20.04.3, tmux 3.0a, micro text editor v2.0.10

Description of issue

When using the micro text editor within a tmux window, typing modifier key + arrows just echo the text of the key code instead of performing the the navigation or selection actions.

Debug info

my ~/.tmux.conf doesn't have any key bindings associated to Shift-arrows, Ctrl-arrows, Alt-arrows, Ctrl-Shift-arrows.

Here is literally the content of the micro editor when typing xxx-arrows

Shift Left/Right: [1;2D] [1;2C]
Shift Up/Down   : [1;2A] [1;2B]
Ctrl  Left/Right: [1;5D] [1;5C]
Ctrl  Up/Down   : [1;5A] [1;5B]
C-Sht Left/Right: [1;6D] [1;6C]
C-Sht Up/Down   : [1;6A] [1;6B]
Alt Left/Right  : [1;3D] [1;3C]
Alt Up/Down     : [1;3A] [1;3D]

Running micro outside of tmux, for example in Gnome terminal. There is no problem. ie the modifier key + arrows performs their intended actions.

Running nano or vim within tmux, the modifier key + arrows does NOT echo the keycode [1;xx] in the editor area.

Also tried to enable the following option in ~/.tmux.conf (and reload the config)

  • set-window-option -g xterm-keys on
  • set-option -g xterm-keys on

There is no improvement whether one or both of the options is enable. Currently my ~/.tmux.conf doesn't set any of those options.

QUESTION

Is this issue related to tmux or the micro text editor? And hopefully there is a fix.

1 Answers

Workaround (by micro author): https://github.com/zyedidia/micro/issues/983#issuecomment-355867571

Edit ~/.config/micro/bindings.json, add

{
    "\u001b[1;2A": "SelectUp",
    "\u001b[1;2B": "SelectDown",
    "\u001b[1;2C": "SelectRight",
    "\u001b[1;2D": "SelectLeft",
    "\u001b[1;3D": "WordLeft",
    "\u001b[1;3C": "WordRight",
    "\u001b[1;3A": "MoveLinesUp",
    "\u001b[1;3B": "MoveLinesDown",
    "\u001b[1;4C": "SelectWordRight",
    "\u001b[1;4D": "SelectWordLeft",
    "\u001b[1;5D": "StartOfLine",
    "\u001b[1;5C": "EndOfLine",
    "\u001b[1;6D": "SelectToStartOfLine",
    "\u001b[1;6C": "SelectToEndOfLine",
    "\u001b[1;5A": "CursorStart",
    "\u001b[1;5B": "CursorEnd",
    "\u001b[1;6A": "SelectToStart",
    "\u001b[1;6B": "SelectToEnd"
}
Related