[tmux] 'send-keys' command behavior (Ctrl + Arrow keys) in post-6.7

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tmux] 'send-keys' command behavior (Ctrl + Arrow keys) in post-6.7

Alessandro De Laurenzis-4
Greetings,

Hope misc@ is the right place for this kind of issues, since I do not
have enough info to fill in a proper bugs@ report.

In both 6.7 and -current, when I issue (in tmux) 'cat -v' I see the
following:

- Left, Right, Up, Down keys:
^[[C ^[[D ^[[A ^[[B

- C-Left, C-Right, C-Up, C-Down combinations:
^[[1;5D ^[[1;5C ^[[1;5A ^[[1;5B

In order to navigate seamlessly between vim and tmux splits using a
consistent set of hotkeys I use a vim plugin (vim-tmux-navigator) and I
have the following settings in ~/.tmux.conf:

bind-key -n 'C-Up'    run-shell "(tmux display-message -p '#{pane_current_command}' | grep -iq vim) && tmux send-keys 'C-Up'   || tmux select-pane -U"
bind-key -n 'C-Down'  run-shell "(tmux display-message -p '#{pane_current_command}' | grep -iq vim) && tmux send-keys 'C-Down' || tmux select-pane -D"
bind-key -n 'C-Right' run-shell "(tmux display-message -p '#{pane_current_command}' | grep -iq vim) && tmux send-keys 'C-Right'|| tmux select-pane -R"
bind-key -n 'C-Left'  run-shell "(tmux display-message -p '#{pane_current_command}' | grep -iq vim) && tmux send-keys 'C-Left' || tmux select-pane -L"

Now, in 6.7 tmux, opening vim and issuing ^v in insert mode before the
key combinations I see (as expected):

- Left, Right, Up, Down keys:
^[OD ^[OC ^[OA ^[OB

- C-Left, C-Right, C-Up, C-Down combinations:
^[[1;5D ^[[1;5C ^[[1;5A ^[[1;5B

but in -current I see the same codes for both singular arrow keys and
Ctrl combinations:

OpenBSD theseus.atlantide.priv 6.7 GENERIC.MP#206 amd64

- Left, Right, Up, Down keys:
^[OD ^[OC ^[OA ^[OB

- C-Left, C-Right, C-Up, C-Down combinations:
^[OD ^[OC ^[OA ^[OB

(for both 6.7 and -current vim version is 8.2.534). Of course, this way
my settings in vim are screwed.

I do not see many relevant commits in tmux since 6.7, except maybe:

https://marc.info/?l=openbsd-cvs&m=158964667912505&w=2
https://marc.info/?l=openbsd-cvs&m=158964675612518&w=2
https://marc.info/?l=openbsd-cvs&m=158964675612518&w=2

but I didn't try to bisect.

Any thoughts?

--
Alessandro De Laurenzis
[mailto:[hidden email]]
Web: http://www.atlantide.mooo.com
LinkedIn: http://it.linkedin.com/in/delaurenzis