diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.txt | 79 | ||||
-rw-r--r-- | runtime/doc/gui.txt | 4 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 3 |
3 files changed, 83 insertions, 3 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 5b48fbd7c7..c56ab70774 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -319,6 +319,7 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) List {count}'th match of {pat} in {expr} max({expr}) Number maximum value of items in {expr} menu_get({path} [, {modes}]) List description of |menus| matched by {path} +menu_info({name} [, {mode}]) Dict get menu item information min({expr}) Number minimum value of items in {expr} mkdir({name} [, {path} [, {prot}]]) Number create directory {name} @@ -5194,6 +5195,7 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()* Can also be used as a |method|: > GetText()->matchstrpos('word') < + *max()* max({expr}) Return the maximum value of all items in {expr}. Example: > echo max([apples, pears, oranges]) @@ -5207,6 +5209,7 @@ max({expr}) Return the maximum value of all items in {expr}. Example: > Can also be used as a |method|: > mylist->max() + menu_get({path} [, {modes}]) *menu_get()* Returns a |List| of |Dictionaries| describing |menus| (defined by |:menu|, |:amenu|, …), including |hidden-menus|. @@ -5253,7 +5256,81 @@ menu_get({path} [, {modes}]) *menu_get()* } ] < - *min()* +menu_info({name} [, {mode}]) *menu_info()* + Return information about the specified menu {name} in + mode {mode}. The menu name should be specified without the + shortcut character ('&'). If {name} is "", then the top-level + menu names are returned. + + {mode} can be one of these strings: + "n" Normal + "v" Visual (including Select) + "o" Operator-pending + "i" Insert + "c" Cmd-line + "s" Select + "x" Visual + "t" Terminal-Job + "" Normal, Visual and Operator-pending + "!" Insert and Cmd-line + When {mode} is omitted, the modes for "" are used. + + Returns a |Dictionary| containing the following items: + accel menu item accelerator text |menu-text| + display display name (name without '&') + enabled v:true if this menu item is enabled + Refer to |:menu-enable| + icon name of the icon file (for toolbar) + |toolbar-icon| + iconidx index of a built-in icon + modes modes for which the menu is defined. In + addition to the modes mentioned above, these + characters will be used: + " " Normal, Visual and Operator-pending + name menu item name. + noremenu v:true if the {rhs} of the menu item is not + remappable else v:false. + priority menu order priority |menu-priority| + rhs right-hand-side of the menu item. The returned + string has special characters translated like + in the output of the ":menu" command listing. + When the {rhs} of a menu item is empty, then + "<Nop>" is returned. + script v:true if script-local remapping of {rhs} is + allowed else v:false. See |:menu-script|. + shortcut shortcut key (character after '&' in + the menu name) |menu-shortcut| + silent v:true if the menu item is created + with <silent> argument |:menu-silent| + submenus |List| containing the names of + all the submenus. Present only if the menu + item has submenus. + + Returns an empty dictionary if the menu item is not found. + + Examples: > + :echo menu_info('Edit.Cut') + :echo menu_info('File.Save', 'n') + + " Display the entire menu hierarchy in a buffer + func ShowMenu(name, pfx) + let m = menu_info(a:name) + call append(line('$'), a:pfx .. m.display) + for child in m->get('submenus', []) + call ShowMenu(a:name .. '.' .. escape(child, '.'), + \ a:pfx .. ' ') + endfor + endfunc + new + for topmenu in menu_info('').submenus + call ShowMenu(topmenu, '') + endfor +< + Can also be used as a |method|: > + GetMenuName()->menu_info('v') + + +< *min()* min({expr}) Return the minimum value of all items in {expr}. Example: > echo min([apples, pears, oranges]) diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 776ff228d6..8f09e5225f 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -201,9 +201,11 @@ tooltips for menus. See |terminal-input|. Special characters in a menu name: + *menu-shortcut* & The next character is the shortcut key. Make sure each shortcut key is only used once in a (sub)menu. If you want to insert a literal "&" in the menu name use "&&". + *menu-text* <Tab> Separates the menu name from right-aligned text. This can be used to show the equivalent typed command. The text "<Tab>" can be used here for convenience. If you are using a real @@ -561,7 +563,7 @@ item for the keyword under the cursor. The register "z" is used. > mappings, or put these lines in your gvimrc; "<C-R>" is CTRL-R, "<CR>" is the <CR> key. |<>|) - + *tooltips* *menu-tips* Tooltips & Menu tips See section |42.4| in the user manual. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index c5fb78157d..008b9b4e58 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -972,7 +972,7 @@ Window size and position: *window-size-functions* winsaveview() get view of current window winrestview() restore saved view of current window -Mappings: *mapping-functions* +Mappings and Menus: *mapping-functions* digraph_get() get |digraph| digraph_getlist() get all |digraph|s digraph_set() register |digraph| @@ -981,6 +981,7 @@ Mappings: *mapping-functions* mapcheck() check if a matching mapping exists maparg() get rhs of a mapping mapset() restore a mapping + menu_info() get information about a menu item wildmenumode() check if the wildmode is active Signs: *sign-functions* |