Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When using vimgrep with lv expr path/**, I like to have a shortcut for navigating the results. So I mapped the F3 key like the following:

nnoremap <F3> :lnext<CR>

Now I would like to do something like the following

nnoremap <SHIFT-F3> :lprevious<CR>

But this does not have the desired effect. How do I map a F-key with SHIFT?


The solution is a bit difficult. In terminals you cannot just map Shift+F3. In fact an additional line like the following is necessary:

set <S-F3>=^[O1;2R
nnoremap <S-F3> :lprevious<CR>

But you cannot copy&paste this, see the link below in the right answer.

share|improve this question
up vote 6 down vote accepted

You're using Vim in the console, not GVIM, right? Anything other than the plain function keys is problematic, and best avoided; try using a prefix like <Leader> instead. If you really want this, you can try the instructions at for getting function keys with modifiers to work.

share|improve this answer
That link was very helpful, I did not even expected a problem like this. Although it is not the answer I wished to read, it is the right answer in my opinion. And following the advise with fast key codes, I could map the key combination as desired. – Trendfischer Nov 22 '12 at 8:21

It should be <S-F3> not <SHIFT-F3>, see :help key-notation in Vim.

share|improve this answer
Yes, this is the answer I wanted to have, but it did not work this way. You need :set for making it in a terminal to work. – Trendfischer Nov 22 '12 at 8:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .