I'm using PuTTY
as SSH client and zsh
as a shell. When I just connect to a host and don't run nvim
, I can see that control-left/right keys work correctly and send a different key from simply pressing an arrow by using ctrl-v
:
# pressing ctrl-v left:
^[OD
# pressing ctrl-v ctrl-left:
^[[D
But when i run neovim :terminal
, I get the same input no matter if I use control or not:
# pressing ctrl-v left:
^[OD
# pressing ctrl-v ctrl-left:
^[OD
Same thing when I just edit a file: In insert mode, ctrl-v ctrl-left
inserts <Left>
instead of <C-Left>
.
This behavior is not reproduced with vim8
, only with neovim
.
The only way I managed to make it work correctly is by using tmux
with options terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@"
and default-terminal "screen-256color"
. However, I want to know how to make neovim correctly recognize ctrl-arrow keys without using tmux
.
My values for $TERM
are: xterm
before starting nvim, xterm-256color
inside nvim.
$TERM
as seen by neovim on the remote host? You can do:echo $TERM
in nvim. (Value should be the same as your local setting as SSH carries it over.) Also, a long shot, but does toggling the "Disable application cursor keys mode" checkbox in Putty settings under Terminal>Features make any difference? (Change, then connect.)tmux
, so I don't see a reason why it shouldn't work with pure nvim.