diff options
author | Ernie Rael <errael@raelity.com> | 2022-04-25 14:40:44 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-25 14:40:44 +0100 |
commit | 09661203ecefbee6a6f09438afcff1843e9dbfb4 (patch) | |
tree | e9287958ff8d1d65e4c5a66703cd9f1d16c237fb /runtime/doc | |
parent | 23d5770ef5e2f5c6d20d123303b81327045e5a1e (diff) | |
download | vim-git-09661203ecefbee6a6f09438afcff1843e9dbfb4.tar.gz |
patch 8.2.4825: can only get a list of mappingsv8.2.4825
Problem: Can only get a list of mappings.
Solution: Add the optional {abbr} argument. (Ernie Rael, closes #10277)
Rename to maplist(). Rename test file.
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/builtin.txt | 28 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 2 |
2 files changed, 16 insertions, 14 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 5a6ebb88c..e6e6dc272 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -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 diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 12d3adc1b..89fca8def 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -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 |