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?
To map a sequence of keys to execute another sequence of keys, use the ':map' command. For example, the following command maps the <F2> key to display the current date and time. The ':map' command creates a key map that works in normal, visual, select and operator pending modes.
Because of Vim's modes, there is not a lot of holding down the Ctrl key while pressing another key. However ,in insert (or replace) mode, Ctrl + R will let you paste a register, and Ctrl + V lets you insert any character literally. Ctrl + W deletes a word, and Ctrl + H backspaces a letter.
1 Answer. Explanation: The map command lets us assign the undefined keys or reassign the defined ones so that when such a key is pressed, it expands to a command sequence.
Calling A Function Vim has a :call command to call a function. The call command does not output the return value. Let's call it with echo . To clear any confusion, you have just used two different call commands: the :call command-line command and the call() function.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With