diff runtime/doc/eval.txt @ 19657:da791e5c0139 v8.2.0385

patch 8.2.0385: menu functionality insufficiently tested Commit: https://github.com/vim/vim/commit/0eabd4dc8ff50658f0ea0e92c7918a42242f6b80 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 15 16:13:53 2020 +0100 patch 8.2.0385: menu functionality insufficiently tested Problem: Menu functionality insufficiently tested. Solution: Add tests. Add menu_info(). (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5760)
author Bram Moolenaar <Bram@vim.org>
date Sun, 15 Mar 2020 16:15:04 +0100
parents 847a300aa244
children bceeded72898
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2601,6 +2601,7 @@ matchstr({expr}, {pat} [, {start} [, {co
 matchstrpos({expr}, {pat} [, {start} [, {count}]])
 				List	{count}'th match of {pat} in {expr}
 max({expr})			Number	maximum value of items in {expr}
+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}
@@ -7124,6 +7125,7 @@ matchstrpos({expr}, {pat} [, {start} [, 
 		Can also be used as a |method|: >
 			GetText()->matchstrpos('word')
 <
+
 							*max()*
 max({expr})	Return the maximum value of all items in {expr}.
 		{expr} can be a List or a Dictionary.  For a Dictionary,
@@ -7135,6 +7137,66 @@ max({expr})	Return the maximum value of 
 		Can also be used as a |method|: >
 			mylist->max()
 
+
+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 ('&').
+
+		{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 maparg('Edit.Cut')
+			:echo maparg('File.Save', 'n')
+<
+		Can also be used as a |method|: >
+			GetMenuName()->maparg('v')
+
+
 <							*min()*
 min({expr})	Return the minimum value of all items in {expr}.
 		{expr} can be a List or a Dictionary.  For a Dictionary,