You are not logged in.

#1 2020-10-10 16:45:39

tomushkin
Member
Registered: 2020-10-10
Posts: 2

[SOLVED] Vim strange behaviour of CTRL-/ mapping under xterm

Hello,

Most terminals will send a <CTRL-_> code when pressing <CTRL-/>. However, vim receives a single / character when running under xterm.

I've tried a couple of things to work around this:

- make vim recognize the key as <CTRL-_> with modifyOtherKeys:

: set <C-_>=^[[27;5;47~

- remap the key in xterm to always send <CTRL-_>

XTerm*VT100.translations:      #override \n\
       Ctrl <Key> /: string(0x1f) \n

These both appear to do the trick, however, as soon as I send another control character, the mapping stops working:

$ vim -Nu NONE -c 'nno <C-_> :echom "Control+/ pressed" <cr>'

1. At first, <C-_> works
2. Press any other CTRL combination
3. <C-_> no longer works

I have no clue how to start investigating this. Any ideas?

Last edited by tomushkin (2020-10-11 09:59:50)

Offline

#2 2020-10-11 09:59:33

tomushkin
Member
Registered: 2020-10-10
Posts: 2

Re: [SOLVED] Vim strange behaviour of CTRL-/ mapping under xterm

For anyone interested, see here: https://github.com/vim/vim/issues/7108

Changing the sequence for <C-_> under modifyOtherKeys terminal is not recommended.

You can either disable modifyOtherKeys with `set t_TI= t_TE=` or map <C-/> directly with `map <C-/> <C-_>`.

Offline

Board footer

Powered by FluxBB