Home Explore Blog CI



neovim

1st chunk of `runtime/doc/map.txt`
240d7fcaec970cb336013c52ebd4a3ae1641aa3fd5bbb8610000000100000fa5
*map.txt*       Nvim


		  VIM REFERENCE MANUAL    by Bram Moolenaar


Key mapping, abbreviations and user-defined commands.

This subject is introduced in sections |05.3|, |24.7| and |40.1| of the user
manual.

                                      Type |gO| to see the table of contents.

==============================================================================
1. Key mapping				*keybind* *key-mapping* *mapping*

Key mapping is used to change the meaning of typed keys.  The most common use
is to define a sequence of commands for a function key.  Example: >

	:map <F2> a<C-R>=strftime("%c")<CR><Esc>

This appends the current date and time after the cursor (in <> notation |<>|).


1.1 MAP COMMANDS					*:map-commands*

There are commands to enter new mappings, remove mappings and list mappings.
See |map-overview| for the various forms of "map" and their relationships with
modes.

{lhs}	means left-hand-side	*{lhs}*
{rhs}	means right-hand-side	*{rhs}*

:map	{lhs} {rhs}		|mapmode-nvo|		*:map*
:nm[ap]	{lhs} {rhs}		|mapmode-n|		*:nm* *:nmap*
:vm[ap]	{lhs} {rhs}		|mapmode-v|		*:vm* *:vmap*
:xm[ap]	{lhs} {rhs}		|mapmode-x|		*:xm* *:xmap*
:smap	{lhs} {rhs}		|mapmode-s|		    *:smap*
:om[ap]	{lhs} {rhs}		|mapmode-o|		*:om* *:omap*
:map!	{lhs} {rhs}		|mapmode-ic|		*:map!*
:im[ap]	{lhs} {rhs}		|mapmode-i|		*:im* *:imap*
:lm[ap]	{lhs} {rhs}		|mapmode-l|		*:lm* *:lma* *:lmap*
:cm[ap]	{lhs} {rhs}		|mapmode-c|		*:cm* *:cmap*
:tma[p]	{lhs} {rhs}		|mapmode-t|		*:tma* *:tmap*
			Map the key sequence {lhs} to {rhs} for the modes
			where the map command applies.  The result, including
			{rhs}, is then further scanned for mappings.  This
			allows for nested and recursive use of mappings.
			Note: Trailing spaces are included in the {rhs},
			because space is a valid Normal mode command.
			See |map-trailing-white|.

						*:nore* *:norem*
:no[remap]  {lhs} {rhs}		|mapmode-nvo|	*:no*  *:noremap* *:nor*
:nn[oremap] {lhs} {rhs}		|mapmode-n|	*:nn*  *:nnoremap*
:vn[oremap] {lhs} {rhs}		|mapmode-v|	*:vn*  *:vnoremap*
:xn[oremap] {lhs} {rhs}		|mapmode-x|	*:xn*  *:xnoremap*
:snor[emap] {lhs} {rhs}		|mapmode-s|	*:snor* *:snore* *:snoremap*
:ono[remap] {lhs} {rhs}		|mapmode-o|	*:ono* *:onoremap*
:no[remap]! {lhs} {rhs}		|mapmode-ic|	*:no!* *:noremap!*
:ino[remap] {lhs} {rhs}		|mapmode-i|	*:ino* *:inor* *:inoremap*
:ln[oremap] {lhs} {rhs}		|mapmode-l|	*:ln*  *:lnoremap*
:cno[remap] {lhs} {rhs}		|mapmode-c|	*:cno* *:cnor* *:cnoremap*
:tno[remap] {lhs} {rhs}		|mapmode-t|	*:tno* *:tnoremap*
			Map the key sequence {lhs} to {rhs} for the modes
			where the map command applies.  Disallow mapping of
			{rhs}, to avoid nested and recursive mappings.  Often
			used to redefine a command.
			Note: Keys in {rhs} also won't trigger abbreviation,
			with the exception of |i_CTRL-]| and |c_CTRL-]|.
			Note: When <Plug> appears in the {rhs} this part is
			always applied even if remapping is disallowed.


:unm[ap]  {lhs}			|mapmode-nvo|		*:unm*  *:unmap*
:nun[map] {lhs}			|mapmode-n|		*:nun*  *:nunmap*
:vu[nmap] {lhs}			|mapmode-v|		*:vu*   *:vunmap*
:xu[nmap] {lhs}			|mapmode-x|		*:xu*   *:xunmap*
:sunm[ap] {lhs}			|mapmode-s|		*:sunm* *:sunmap*
:ou[nmap] {lhs}			|mapmode-o|		*:ou*   *:ounmap*
:unm[ap]! {lhs}			|mapmode-ic|		*:unm!* *:unmap!*
:iu[nmap] {lhs}			|mapmode-i|		*:iu*   *:iunmap*
:lu[nmap] {lhs}			|mapmode-l|		*:lu*   *:lunmap*
:cu[nmap] {lhs}			|mapmode-c|		*:cu*   *:cun* *:cunmap*
:tunma[p] {lhs}			|mapmode-t|		*:tunma* *:tunmap*
			Remove the mapping of {lhs} for the modes where the
			map command applies.  The mapping may remain defined
			for other modes where it applies.
			It also works when {lhs} matches the {rhs} of a
			mapping. This is for when an abbreviation applied.
			Note: Trailing spaces are included in the {lhs}.
			See |map-trailing-white|.

:mapc[lear]			|mapmode-nvo|		*:mapc*   *:mapclear*
:nmapc[lear]			|mapmode-n|		*:nmapc*  *:nmapclear*
:vmapc[lear]			|mapmode-v|		*:vmapc*  *:vmapclear*
:xmapc[lear]			|mapmode-x|		*:xmapc*  *:xmapclear*

Title: Vim Key Mapping Commands
Summary
This section of the Vim reference manual explains key mapping, which allows changing the meaning of typed keys. It details the commands for creating, removing, and listing mappings, including variations for different modes (Normal, Visual, Insert, etc.). The commands include `:map`, `:noremap`, and `:unmap`, with mode-specific versions like `:nmap` for Normal mode. It also covers `:mapclear` to remove all mappings for a given mode.