aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-11-09 18:16:49 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-11-09 21:34:04 +0800
commit2dfcd5a22b8f26091aa7398fdb8b0ea70ed7b28d (patch)
tree33540db6f3104e7844ac05fdeb332fe64b046a3e /src/nvim/eval.lua
parenta4b80c71eae09a5f6f76bce46be46efd247c7223 (diff)
downloadrneovim-2dfcd5a22b8f26091aa7398fdb8b0ea70ed7b28d.tar.gz
rneovim-2dfcd5a22b8f26091aa7398fdb8b0ea70ed7b28d.tar.bz2
rneovim-2dfcd5a22b8f26091aa7398fdb8b0ea70ed7b28d.zip
vim-patch:8.2.4820: not simple programmatic way to find a specific mapping
Problem: Not simple programmatic way to find a specific mapping. Solution: Add getmappings(). (Ernie Rael, closes vim/vim#10273) https://github.com/vim/vim/commit/659c240cf769925ff432b88df8719e7ace4629b0 Co-authored-by: Ernie Rael <errael@raelity.com>
Diffstat (limited to 'src/nvim/eval.lua')
-rw-r--r--src/nvim/eval.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 0b81e2eb65..5aa4d65362 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -3957,6 +3957,22 @@ M.funcs = {
params = { { 'nr', 'integer' }, { 'what', 'any' } },
signature = 'getloclist({nr} [, {what}])',
},
+ getmappings = {
+ args = 0,
+ desc = [[
+ 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: >
+ echo getmappings()->filter({_, m ->
+ \ match(get(m, 'rhs', ''), 'MultiMatch') >= 0
+ \ })
+ ]],
+ name = 'getmappings',
+ params = {},
+ signature = 'getmappings()'
+ },
getmarklist = {
args = { 0, 1 },
base = 1,
@@ -6170,7 +6186,7 @@ M.funcs = {
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