

snoremap - works non-recursively in select mode.xnoremap - works non-recursively in visual mode.vnoremap - works non-recursively in visual and select modes.inoremap - works non-recursively in insert mode.nnoremap - works non-recursively in normal mode.omap - works recursively in operator pending mode.cmap - works recursively in command-line mode.smap - works recursively in select mode.xmap - works recursively in visual mode.vmap - works recursively in visual and select modes.imap - works recursively in insert mode.nmap - works recursively in normal mode.You can think of it as no to avoid nested and recursive mappings. noremap! - works non-recursively in insert and command-line modes.noremap - works n on-recursively in normal, visual, select and operator pending modes.The non-recursive variations of these commands are: map! - works recursively in insert and command-line modes.map - works recursively in normal, visual, select and operator pending modes.This mapping doesn't affect pressing K regardless of whether G was mapped recursively or not, since it's line 2 that causes the expansion of K to stop, so line 3 wouldn't be used.įirst, we have two general mapping commands: The mapping of G to gg only applies if you press G, but not if you press K. At most one non-recursive mapping will ever be applied in an expansion chain (it would be the last expansion to happen). It stops because of the nnoremap, which expands and stops immediately. The above causes K to expand to H, then H to expand to G and stop. " Non-recursive" means the mapping is only expanded once, and that result is applied/executed. the "noremap" is the final expansion).Īt that point, Vim's default "meaning" of the final result is applied/executed. a non-recursive mapping has been applied (i.e.the result is no longer mapped to anything else.The expansion stops when one of these is true: " Recursive" means that the mapping is expanded to a result, then the result is expanded to another result, and so on. Collectively called "Lang-Arg" pseudo-mode) l: insert, command-line, regexp-search (and others.
#VIM MEANING HOW TO#
Use help map-modes will show you a few tables that explain how to control which modes the mapping applies to. only "visual"), or choose other modes that map wouldn't apply to (e.g. It can choose a subset of the list of applicable modes (e.g. Prepending a mode letter like n modify the modes the mapping works in. See below for what "recursive" means in this context. (Note that there are also the ! modes like map! that apply to insert & command-line.) (Think of the nore prefix to mean "non-recursive".) The root form applies to the same modes as map. Noremap is the "root" of all non-recursive mapping commands. (I'm using the term "root" as in linguistics.) The root form applies to "normal", "visual+select", and "operator-pending" modes. Map is the "root" of all recursive mapping commands. Just telling you what they do doesn't help you remember the names. I think the Vim documentation should've explained the meaning behind the naming of these commands. It has a normal mode, visual mode and other modes.įor each of these sets of mappings, there is a mapping that works in normal, visual, select and operator modes ( :map and :noremap), one that works in normal mode ( :nmap and :nnoremap), one in visual mode ( :xmap and :xnoremap) and so on.įor more guidance on this, see: :help :map

Remap is an option that makes mappings work recursively.
