mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 06:18:16 +00:00
menu_get(): doc
This commit is contained in:
@@ -5509,43 +5509,48 @@ max({expr}) Return the maximum value of all items in {expr}.
|
||||
an error. An empty |List| or |Dictionary| results in zero.
|
||||
|
||||
menu_get({path}, {modes}) *menu_get()*
|
||||
Returns a |Dictionary| with all the submenu of {path} (set to
|
||||
an empty string to match all menus). Only the commands matching {modes} are
|
||||
returned ('a' for all, 'i' for insert see |creating-menus|).
|
||||
Returns a |List| of |Dictionaries| describing |menus| (defined
|
||||
by |:menu|, |:amenu|, etc.).
|
||||
{path} limits the result to a subtree of the menu hierarchy
|
||||
(empty string matches all menus). E.g. to get items in the
|
||||
"File" menu subtree: >
|
||||
:echo menu_get('File','')
|
||||
<
|
||||
{modes} is a string of zero or more modes (see |maparg()| or
|
||||
|creating-menus| for the list of modes). "a" means "all".
|
||||
|
||||
For instance, executing:
|
||||
>
|
||||
For example: >
|
||||
nnoremenu &Test.Test inormal
|
||||
inoremenu Test.Test insert
|
||||
vnoremenu Test.Test x
|
||||
echo menu_get("")
|
||||
<
|
||||
should produce an output with a similar structure:
|
||||
returns something like this:
|
||||
>
|
||||
[ {
|
||||
"hidden": 0,
|
||||
"name": "Test",
|
||||
"priority": 500,
|
||||
"shortcut": 84,
|
||||
"submenus": [ {
|
||||
"hidden": 0,
|
||||
"mappings": {
|
||||
i": {
|
||||
"enabled": 1,
|
||||
"noremap": 1,
|
||||
"rhs": "insert",
|
||||
"sid": 1,
|
||||
"silent": 0
|
||||
},
|
||||
n": { ... },
|
||||
s": { ... },
|
||||
v": { ... }
|
||||
},
|
||||
"name": "Test",
|
||||
"priority": 500,
|
||||
"shortcut": 0
|
||||
} ]
|
||||
} ]
|
||||
[ {
|
||||
"hidden": 0,
|
||||
"name": "Test",
|
||||
"priority": 500,
|
||||
"shortcut": 84,
|
||||
"submenus": [ {
|
||||
"hidden": 0,
|
||||
"mappings": {
|
||||
i": {
|
||||
"enabled": 1,
|
||||
"noremap": 1,
|
||||
"rhs": "insert",
|
||||
"sid": 1,
|
||||
"silent": 0
|
||||
},
|
||||
n": { ... },
|
||||
s": { ... },
|
||||
v": { ... }
|
||||
},
|
||||
"name": "Test",
|
||||
"priority": 500,
|
||||
"shortcut": 0
|
||||
} ]
|
||||
} ]
|
||||
<
|
||||
|
||||
*min()*
|
||||
|
@@ -127,6 +127,7 @@ Functions:
|
||||
|dictwatcheradd()| notifies a callback whenever a |Dict| is modified
|
||||
|dictwatcherdel()|
|
||||
|execute()| works with |:redir|
|
||||
|menu_get()|
|
||||
|msgpackdump()|, |msgpackparse()| provide msgpack de/serialization
|
||||
|
||||
Events:
|
||||
|
Reference in New Issue
Block a user