:map <F6>
to see what is mapped to <F6>
and in which mode.:verbose map <F6>
to also see where it was last mapped.:map
and :map!
are too generic. Use :n[nore]map
for normal mode mappings, :i[nore]map
for insert mode, :x[nore]map
for visual mode, etc.Use recursive mappings only if you intend to use other mappings in your mappings:
nnoremap b B
nmap <key> db
In this example, b
is made to work like B
in normal mode. Since we use b
in a recursive mapping, pressing <key>
will work like dB
, not like db
.
Use non-recursive mappings only if you intend to use default commands in your mappings, which is almost always what you want:
nnoremap <key> db
In this example, we use b
in a non-recursive mapping so pressing key will always work like db
, whether we remapped b
or not.
nnoremap <key> :MyCommand<CR>
nnoremap <key> :MyCommand <bar> MyOtherCommand <bar> SomeCommand<CR>
nnoremap <key> :call SomeFunction()<CR>
<Plug>
mappingmap <key> <Plug>name_of_mapping
See :help map-commands
, :help key-notation
and :help <plug>
.
see Key Mappings in Vim for futher read