summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorErnie Rael <errael@raelity.com>2022-04-24 18:40:28 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-24 18:40:28 +0100
commit659c240cf769925ff432b88df8719e7ace4629b0 (patch)
treedb1831765bb4392807a11a7b05c2b791f6a71894 /runtime
parenta4e3332650021921068ef12923b4501c5b9918cb (diff)
patch 8.2.4820: not simple programmatic way to find a specific mappingv8.2.4820
Problem: Not simple programmatic way to find a specific mapping. Solution: Add getmappings(). (Ernie Rael, closes #10273)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/builtin.txt14
-rw-r--r--runtime/doc/usr_41.txt1
2 files changed, 14 insertions, 1 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 8695edd2dd..5a6ebb88c1 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -235,6 +235,7 @@ 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
@@ -3570,6 +3571,17 @@ 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|
@@ -5262,7 +5274,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
When {dict} is there and it is |TRUE| return a dictionary
containing all the information of the mapping with the
- following items:
+ following items: *mapping-dict*
"lhs" The {lhs} of the mapping as it would be typed
"lhsraw" The {lhs} of the mapping as raw bytes
"lhsrawalt" The {lhs} of the mapping as raw bytes, alternate
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index eb269e16cb..12d3adc1b0 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1089,6 +1089,7 @@ 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