I would like to do something like
map <C-k> :e#<CR>
in my .vimrc
.
However, I recently found that <C-k>
is used for digraphs.
How do I get a list of unmapped control keys in vim?
Use :map! and :map for manually set keys and :help 'char(-combination)' to find out which keys are already mapped in vim out-of-the-box(/out of your specific compiling options).
On vim , command-mode keys can be mapped through the ex command :map <key> <macro> and insert-mode keys can be mapped through :map! <key> <macro> . After mapped, the commands to remove the mapping from the command-mode keys and insert-mode keys are unmap <key> and unmap!
When the map is invoked, Vim replaces the two Ctrl-V characters with a single Ctrl-V character. You can also enter a control character by pressing Ctrl-V followed by the decimal or octal or hexadecimal value of the character.
<silent> tells vim to show no message when this key sequence is used. <leader> means the key sequence starts with the character assigned to variable mapleader -- a backslash, if no let mapleader = statement has executed yet at the point nmap executes.
Vim has many commands, so it can be a challenge to find a (memorable and short) key sequence for mappings.
My approach is to use the recommended <Leader>
prefix for things I do not use frequently, but for essential stuff a mapping with Ctrl is useful, indeed.
Learn how the commands are represented in the help (e.g. CTRL-O
in normal mode, i_CTRL-X_CTRL-N
for insert mode), think of a good mapping candidate, then try to look it up via :help CTRL-...
) If there are no matches, you can make sure that the mapping is free via :nmap C-...
; if there is a match (the nice thing is that this also covers plugins that supply documentation), you can read the description, have at least discovered a new Vim command, and can then decide whether you need it (then retry with a different mapping candidate), or whether you override the command.
(Note that you can also :noremap
built-in commands to other keys, but be aware that this makes you increasingly helpless in vanilla Vim installations or other application's vi-emulation modes.)
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