Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find unmapped control keys in vim?

Tags:

vim

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?

like image 710
kfmfe04 Avatar asked Nov 22 '12 09:11

kfmfe04


People also ask

How do you check if a key is mapped 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).

How do I Unmap a vim key?

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!

What is the Control key in vim?

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.

What is silent key in vim?

<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.


1 Answers

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.)

like image 198
Ingo Karkat Avatar answered Oct 15 '22 04:10

Ingo Karkat