[edit: for all ref's to 'vim', read 'neovim' - see comments for clarification]
On a UK keyboard, the shifted characters for the number keys (1...9, and 0) are;-
! " £ $ % ^ & * ( )
When I use vim within xterm, xterm generates most of the above characters as-is (ie, if I press 'shift-1', vim sees a '!' character). However, for reasons that I cannot fathom, xterm treats the '6' key differently from the rest; if I press 'shift-6', vim sees 'shift-^' rather than just '^'.
There are a few other keys scattered around the keyboard that have the same issue. It doesn't seem to bother vim when entering text but it is a problem because it breaks quite a few key mappings in various scripts for vim (I have previously added additional mappings; '<S-^>' instead of just '^' but it's an unsatisfactory solution)
To try and fix this, I added the following key translation to ~/.Xresources;-
XTerm*vt100.translations: #override \
~Ctrl ~Meta ~Alt Shift<Key>^: string("^") \n\
~Ctrl ~Meta ~Alt Shift<Key>_: string("_") \n\
~Ctrl ~Meta ~Alt Shift<Key>{: string("{") \n\
~Ctrl ~Meta ~Alt Shift<Key>}: string("}") \n\
~Ctrl ~Meta ~Alt Shift<Key>@: string("@") \n\
~Ctrl ~Meta ~Alt Shift<Key>~: string("~") \n\
~Ctrl ~Meta ~Alt Shift<Key>|: string("|")
(just for reference, the 6 characters _ { } @ ~ and | are generated from the shifted keys - [ ] ' # and \ respectively)
This (mostly) "works" (pressing shift-6 now presents vim with the character sequence '^' instead of 'shift-^')
However, I have now created a new problem; shift-7 now generates the character '{' instead of '&', and shift-0 now generates '}' instead of ')'. All the other keys seem to be correct
So, I tried adding an extra two translations (and yes, I realise they aren't really translating anything but I thought it worth a go);-
~Ctrl ~Meta ~Alt ~Shift <Key>&: string("&") \n\
~Ctrl ~Meta ~Alt ~Shift <Key>): string(")")
...but this makes no difference at all. I also tried the following but same result;-
~Ctrl ~Meta ~Alt Shift<Key>7: string("&") \n\
~Ctrl ~Meta ~Alt Shift<Key>0: string(")")
Can anyone cast any light on what I'm missing please? Why does xterm behave like this in the first place for only some keys (I've never seen this problem using any other terminal)? Am I going about fixing this the wrong way? Have I just missed out a part of the fix?
Any help would be much appreciated
6anymore), or if it is low level driver, or X11, or xterm, or vim (you seem to focus onxterm. Yet you tagged thisvim, and you only mention that it bothers you invim)xevsays when you test those keystrokes? Another app (for example another editor) with the same terminal? Or vim (or plainvi) once removed all.vimrcand.vimdirsxmodmap -pkesays about the concerned keycodes (at least the one of key6and maybe the one ofshift)? And what else is there in your.Xresources?