1

My keyboard has extra hotkeys like "Back" and "Forward" that work in a web browser. I would like to use these types of keys as hotkeys in vim. How can I find out what vim sees these keys as so that they can be used as hotkeys in vim?

3
  • 1
    I'm curious. Is it an Ono-Sendai keyboard? Commented Mar 30, 2012 at 23:22
  • It's the next best thing, an Asus Eee. :) Commented Mar 31, 2012 at 0:06
  • 1
    Are you using Gvim or terminal Vim? Terminal Vim has many ordinary keys that can't be recognized. Commented Mar 31, 2012 at 0:32

1 Answer 1

3

Go to the command line, type control-k (you'll get a question mark on the command line), and then hit the key you're interested in. The question mark will be replaced with Vim's definition of what it receives.

In my experience, you won't get a response for every odd key. Also, for some keys you'll get a different response in gVim versus console Vim. I'm stuck on a Windows machine at work, but I sometimes SSH to our Linux server and use Vim there. In both gVim on Windows and console Vim on a Linux box, Vim says that the function key F7 is sending:

<F7> 

And on Windows, when I type shift-F7, Vim reports:

<S-F7> 

That all makes sense. But when I type shift-F7 on the console, it reports:

[31~ 

And after a lot of digging around, I found that to actually use the above value in a map I had to write it as:

<Esc>[31~ 

So my mapping to make F7 increment numbers and shift-F7 decrement numbers looks odd in console Vim:

map <F7> <C-A> map <Esc>[31~ <C-X> 

But it does work.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.