Home Explore Blog CI



neovim

74th chunk of `runtime/doc/vimfn.txt`
77f228c2e2b9129581d719b2b12a202692ba7c3483b4c9c40000000100000fab
 all mappings see |maplist()|.

		When there is no mapping for {name}, an empty String is
		returned if {dict} is FALSE, otherwise returns an empty Dict.
		When the mapping for {name} is empty, then "<Nop>" is
		returned.

		The {name} can have special key names, like in the ":map"
		command.

		{mode} can be one of these strings:
			"n"	Normal
			"v"	Visual (including Select)
			"o"	Operator-pending
			"i"	Insert
			"c"	Cmd-line
			"s"	Select
			"x"	Visual
			"l"	langmap |language-mapping|
			"t"	Terminal
			""	Normal, Visual and Operator-pending
		When {mode} is omitted, the modes for "" are used.

		When {abbr} is there and it is |TRUE| use abbreviations
		instead of mappings.

		When {dict} is |TRUE|, return a dictionary describing the
		mapping, with these items:		*mapping-dict*
		  "lhs"	     The {lhs} of the mapping as it would be typed
		  "lhsraw"   The {lhs} of the mapping as raw bytes
		  "lhsrawalt" The {lhs} of the mapping as raw bytes, alternate
			      form, only present when it differs from "lhsraw"
		  "rhs"	     The {rhs} of the mapping as typed.
		  "callback" Lua function, if RHS was defined as such.
		  "silent"   1 for a |:map-silent| mapping, else 0.
		  "noremap"  1 if the {rhs} of the mapping is not remappable.
		  "script"   1 if mapping was defined with <script>.
		  "expr"     1 for an expression mapping (|:map-<expr>|).
		  "buffer"   1 for a buffer local mapping (|:map-local|).
		  "mode"     Modes for which the mapping is defined. In
			     addition to the modes mentioned above, these
			     characters will be used:
			     " "     Normal, Visual and Operator-pending
			     "!"     Insert and Commandline mode
				     (|mapmode-ic|)
		  "sid"	     The script local ID, used for <sid> mappings
			     (|<SID>|).  Negative for special contexts.
		  "scriptversion"  The version of the script, always 1.
		  "lnum"     The line number in "sid", zero if unknown.
		  "nowait"   Do not wait for other, longer mappings.
			     (|:map-<nowait>|).
		  "abbr"     True if this is an |abbreviation|.
		  "mode_bits" Nvim's internal binary representation of "mode".
			     |mapset()| ignores this; only "mode" is used.
			     See |maplist()| for usage examples. The values
			     are from src/nvim/state_defs.h and may change in
			     the future.

		The dictionary can be used to restore a mapping with
		|mapset()|.

		The mappings local to the current buffer are checked first,
		then the global mappings.
		This function can be used to map a key even when it's already
		mapped, and have it do the original mapping too.  Sketch: >vim
			exe 'nnoremap <Tab> ==' .. maparg('<Tab>', 'n')
<

                Parameters: ~
                  • {name} (`string`)
                  • {mode} (`string?`)
                  • {abbr} (`boolean?`)
                  • {dict} (`false?`)

                Return: ~
                  (`string`)

mapcheck({name} [, {mode} [, {abbr}]])                              *mapcheck()*
		Check if there is a mapping that matches with {name} in mode
		{mode}.  See |maparg()| for {mode} and special names in
		{name}.
		When {abbr} is there and it is non-zero use abbreviations
		instead of mappings.
		A match happens with a mapping that starts with {name} and
		with a mapping which is equal to the start of {name}.

			matches mapping "a"	"ab"	"abc" ~
		   mapcheck("a")	yes	yes	 yes
		   mapcheck("abc")	yes	yes	 yes
		   mapcheck("ax")	yes	no	 no
		   mapcheck("b")	no	no	 no

		The difference with maparg() is that mapcheck() finds a
		mapping that matches with {name}, while maparg() only finds a
		mapping for {name} exactly.
		When there is no mapping that starts with {name}, an empty
		String is returned.  If there is one, the RHS of that mapping
		is returned.  If there are several mappings that start with
		{name}, the RHS of one of them is returned.  This will be
		"<Nop>" if the RHS is empty.
		The mappings local to the current buffer are checked first,
		then the global mappings.
		This function

Title: Vim Function Documentation: maparg() details, mapcheck()
Summary
This section provides detailed information about the `maparg()` function, including the structure of the dictionary returned when the `dict` argument is true. It also describes the `mapcheck()` function, which checks for mappings that match a given name in a specified mode, returning the right-hand side of the matching mapping or an empty string if no match is found. It explains the nuances of matching and how it differs from `maparg()`.