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).
Creating keymaps 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. The ':map!'
<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.
You can do that with the :map
command. There are also other variants.
:nmap
for normal mode mappings:vmap
for visual mode mappings:imap
for insert mode mappingsThe above list is not complete. Typing :help map
in Vim will give you more info.
:redir! > vim_keys.txt
:silent verbose map
:redir END
This outputs the shortcuts, with where they were defined, to a text file.
In addition to answers about :map
with no arguments: do not miss its verbose form (:verbose map
) which shows where the mapping(s) was defined (see :help map-verbose
).
Quite simply, just run the :map
variants with no arguments.
:map
:imap
:vmap
:map
and its friends are the key, :verbose
adds info and :redir
allow post-search refinement.
They are a perfect mix to show what command is bind to what shortcut and viceversa, but if you want to search some keys and avoid temp files whenever you need to search mappings, take a look to scriptease and :Verbose
command.
It is a wrapper on :verbose
to show result in a preview window.
this way you can search whatever you want inside results without using temp files
type :Verbose map
and use / ? as usual.
Another way is to save session to a file and then edit this file as it contains all the mappings and settings.
:mks[ession] [file]
- Write a Vim script that restores the current editing
session.
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