1
0
forked from aniani/vim

patch 8.2.4825: can only get a list of mappings

Problem:    Can only get a list of mappings.
Solution:   Add the optional {abbr} argument. (Ernie Rael, closes #10277)
            Rename to maplist().  Rename test file.
This commit is contained in:
Ernie Rael
2022-04-25 14:40:44 +01:00
committed by Bram Moolenaar
parent 23d5770ef5
commit 09661203ec
8 changed files with 74 additions and 40 deletions

View File

@@ -235,7 +235,6 @@ getline({lnum}) String line {lnum} of current buffer
getline({lnum}, {end}) List lines {lnum} to {end} of current buffer
getloclist({nr}) List list of location list items
getloclist({nr}, {what}) Dict get specific location list properties
getmappings() List list of all mappings, a dict for each
getmarklist([{buf}]) List list of global/local marks
getmatches([{win}]) List list of current matches
getmousepos() Dict last known mouse position
@@ -338,6 +337,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]])
rhs of mapping {name} in mode {mode}
mapcheck({name} [, {mode} [, {abbr}]])
String check for mappings matching {name}
maplist([{abbr}]) List list of all mappings, a dict for each
mapnew({expr1}, {expr2}) List/Dict/Blob/String
like |map()| but creates a new List or
Dictionary
@@ -3571,17 +3571,6 @@ getloclist({nr} [, {what}]) *getloclist()*
:echo getloclist(5, {'filewinid': 0})
getmappings() *getmappings()*
Returns a |List| of all mappings. Each List item is a |Dict|,
the same as what is returned by |maparg()|, see
|mapping-dict|.
Example to show all mappings with 'MultiMatch' in rhs: >
vim9script
echo getmappings()->filter(
(_, m) => match(m.rhs, 'MultiMatch') >= 0)
getmarklist([{buf}]) *getmarklist()*
Without the {buf} argument returns a |List| with information
about all the global marks. |mark|
@@ -5247,7 +5236,8 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
When {dict} is omitted or zero: Return the rhs of mapping
{name} in mode {mode}. The returned String has special
characters translated like in the output of the ":map" command
listing.
listing. When {dict} is TRUE a dictionary is returned, see
below. To get a list of all mappings see |maplist()|.
When there is no mapping for {name}, an empty String is
returned. When the mapping for {name} is empty, then "<Nop>"
@@ -5348,6 +5338,18 @@ mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
GetKey()->mapcheck('n')
maplist([{abbr}]) *maplist()*
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)
mapnew({expr1}, {expr2}) *mapnew()*
Like |map()| but instead of replacing items in {expr1} a new
List or Dictionary is created and returned. {expr1} remains

View File

@@ -1089,10 +1089,10 @@ Mappings and Menus: *mapping-functions*
digraph_getlist() get all |digraph|s
digraph_set() register |digraph|
digraph_setlist() register multiple |digraph|s
getmappings() get list of all mappings
hasmapto() check if a mapping exists
mapcheck() check if a matching mapping exists
maparg() get rhs of a mapping
maplist() get list of all mappings
mapset() restore a mapping
menu_info() get information about a menu item
wildmenumode() check if the wildmode is active