"nowait" Do not wait for other, longer mappings.
(|:map-<nowait>|).
"abbr" True if this is an abbreviation |abbreviations|.
+ "mode_bits" Vim's internal binary representation of "mode".
+ |mapset()| ignores this; only "mode" is used.
+ See |maplist()| for usage examples. The values
+ are from src/vim.h and may change in the future.
The dictionary can be used to restore a mapping with
|mapset()|.
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)
mapnew({expr1}, {expr2}) *mapnew()*
\ 'lhsraw': "foo\x80\xfc\x04V", 'lhsrawalt': "foo\x16",
\ 'mode': ' ', 'nowait': 0, 'expr': 0, 'sid': sid, 'scriptversion': 1,
\ 'lnum': lnum + 1,
- \ 'rhs': 'is<F4>foo', 'buffer': 0, 'abbr': 0},
+ \ 'rhs': 'is<F4>foo', 'buffer': 0, 'abbr': 0, 'mode_bits': 0x47},
\ maparg('foo<C-V>', '', 0, 1))
call assert_equal({'silent': 1, 'noremap': 1, 'script': 1, 'lhs': 'bar',
\ 'lhsraw': 'bar', 'mode': 'v',
\ 'nowait': 0, 'expr': 1, 'sid': sid, 'scriptversion': 1,
\ 'lnum': lnum + 2,
- \ 'rhs': 'isbar', 'buffer': 1, 'abbr': 0},
+ \ 'rhs': 'isbar', 'buffer': 1, 'abbr': 0, 'mode_bits': 0x42},
\ 'bar'->maparg('', 0, 1))
let lnum = expand('<sflnum>')
map <buffer> <nowait> foo bar
\ 'lhsraw': 'foo', 'mode': ' ',
\ 'nowait': 1, 'expr': 0, 'sid': sid, 'scriptversion': 1,
\ 'lnum': lnum + 1, 'rhs': 'bar',
- \ 'buffer': 1, 'abbr': 0},
+ \ 'buffer': 1, 'abbr': 0, 'mode_bits': 0x47},
\ maparg('foo', '', 0, 1))
let lnum = expand('<sflnum>')
tmap baz foo
\ 'lhsraw': 'baz', 'mode': 't',
\ 'nowait': 0, 'expr': 0, 'sid': sid, 'scriptversion': 1,
\ 'lnum': lnum + 1, 'rhs': 'foo',
- \ 'buffer': 0, 'abbr': 0},
+ \ 'buffer': 0, 'abbr': 0, 'mode_bits': 0x80},
\ maparg('baz', 't', 0, 1))
let lnum = expand('<sflnum>')
iab A B
\ 'lhsraw': 'A', 'mode': 'i',
\ 'nowait': 0, 'expr': 0, 'sid': sid, 'scriptversion': 1,
\ 'lnum': lnum + 1, 'rhs': 'B',
- \ 'buffer': 0, 'abbr': 1},
+ \ 'buffer': 0, 'abbr': 1, 'mode_bits': 0x0010},
\ maparg('A', 'i', 1, 1))
iuna A