import { maplist } from "https://deno.land/x/denops_std@v6.3.0/function/vim/mod.ts";
Returns a List
of all mappings. Each List item is a Dict
,
the same as what is returned by maparg()
, see
mapping-dict
. When {abbr} is there and it is TRUE
use
abbreviations instead of mappings.
Example to show all mappings with 'MultiMatch' in rhs:
vim9script
echo maplist()->filter(
(_, m) => match(m.rhs, 'MultiMatch') >= 0)
It can be tricky to find mappings for particular :map-modes
.
mapping-dict
's "mode_bits" can simplify this. For example,
the mode_bits for Normal, Insert or Command-line modes are
0x19. To find all the mappings available in those modes you
can do:
vim9script
var saved_maps = []
for m in maplist()
if and(m.mode_bits, 0x19) != 0
saved_maps->add(m)
endif
endfor
echo saved_maps->mapnew((_, m) => m.lhs)
The values of the mode_bits are defined in Vim's src/vim.h
file and they can be discovered at runtime using
:map-commands
and "maplist()". Example:
vim9script
omap xyzzy <Nop>
var op_bit = maplist()->filter(
(_, m) => m.lhs == 'xyzzy')[0].mode_bits
ounmap xyzzy
echo printf("Operator-pending mode bit: 0x%x", op_bit)
Parameters
denops: Denops