Hi all,
I've had a weird bug for about a year now,
where these four keyboard shortcuts would stop working eventually:
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
In particular, they would revert to their original function,
almost as if they were never mapped in my vimrc.
For example, <C-L> would revert to "clear", and <C-H> to "backspace"
The only way to resolve this issue would be to restart Vim.
With the help of Paul Jolly, who also ran into this bug,
we were able to narrow it down: it happens after we press <C-;>.
That is, control-semicolon.
Note that some terminals do not seem to emit escape codes for <C-;>.
For example, for xterm, one needs this extra setting in .Xresources:
XTerm*vt100.modifyOtherKeys: 1
I have been able to reproduce this with xterm 369 and vim 8.2.3441.
Both with only the options listed above, and no extra plugins.
With a feature like "modifyOtherKeys" disabled, the bug disappears,
as it seems like xterm just sends ";" when pressing <C-;>.
For clarity, here's what I do to reproduce it with two sample files:
1) vim foo.txt
2) :vsp bar.txt
3) Verify that <C-H> and <C-L> work to switch back and forth
4) Press <C-;>
5) Notice that <C-H> and <C-L> no longer work to switch buffers
I've spent hours investigating this bug, and this is as far as I've got.
I'm hoping someone in this mailing list can shed some light into it.
My best guess is this is a bug in how Vim handles ANSI escape codes.
Note that if I "xterm -e dash" and press <C-;>,
I get the following escape code: ^[[27;5;59~
Here are other scenarios I've ruled out:
* Terminal emulator bug; it also reproduces with my emulator of choice,
https://codeberg.org/dnkl/foot/, which implements "modifyOtherKeys".
* Issue with my vimrc; reproduced with just those four lines.
* Issue with vim running inside bash; happens with "xterm -e vim" too.
* System shortcuts; Paul and myself can reproduce on different setups.
Any help appreciated. Happy to try patches or capture debug logs.
Thank you!