Go to the command line, enter control-k (you will get a question mark on the command line), and then press the key you are interested in. The question mark will be replaced with a Vim definition of what it accepts.
In my experience, you will not get an answer for every odd key. Also, for some keys, you will get a different answer in gVim against the Vim console. I am stuck on a Windows computer, but sometimes I use SSH for our Linux server and use Vim. In both gVim on Windows and the Vim console on the Linux box, Vim says that the F7 function key sends:
<F7>
And on Windows, when I enter shift-F7, Vim reports:
<S-F7>
It all makes sense. But when I type shift-F7 on the console, it reports:
[31~
And after a lot of jerking, I found that in order to actually use the above value on the map, I had to write it as:
<Esc>[31~
So my mapping for adding F7 increment numbers and F7 shift decrement numbers looks odd in the Vim console:
map <F7> <CA> map <Esc>[31~ <CX>
But it works.
source share