import { mapcheck } from "https://deno.land/x/denops_std@v5.0.2/function/mod.ts";
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 TRUE
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 can be used to check if a mapping can be added
without being ambiguous. Example:
:if mapcheck("_vv") == ""
: map _vv :set guifont=7x13<CR>
:endif
This avoids adding the "_vv" mapping when there already is a mapping for "_v" or for "_vvv".
Can also be used as a method
:
GetKey()->mapcheck('n')