Drew Stephens
Drew Stephens

Reputation: 17827

How can I create a mapping with control and a function key in Vim?

I would like to have a mapping to quickly quit all buffers, for use when I'm vimdiffing a lot of files. Control and a function key together proved a good safety, so that I don't accidentally hit this combination, unintentionally leaving Vim. I tried the following mapping:

map <C-F10> :qa<CR>

To no avail. If I ditch the control, I can quit with F10 alone—why doesn't control work with F10 in my mapping?

Upvotes: 5

Views: 858

Answers (2)

Dr. Frankenstein
Dr. Frankenstein

Reputation: 4684

Luc is right - I just tried that in gvim (well, MacVim) and it worked fine. Then I tried it in the terminal with no joy.

Upvotes: 1

Luc Hermitte
Luc Hermitte

Reputation: 32936

I suspect you are using vim and not gvim. vim keybindings are limited by the terminal we are running vim within.

I've given up on vim, and I systematically use gvim for that reason.

Upvotes: 8

Related Questions