Hi all,
When trying to develop tests for the menu functionality, I realized
that there is no function to get information about the menu items.
As part of PR #5760, I have added a new menu_getprop() function
that returns information about the specified menu item(s).
The help text for this new function is below. Let me know if you have
any comments/suggestions.
Thanks,
Yegappan
------------------------------------------------------------------------------------------
menu_getprop([{name}])
Returns the properties of the specified menu item {name}.
If {name} is not specified or empty, then returns the
properties of all the menu items. The menu item name should be
specified without the shortcut character ('&'). Returns a
|Dictionary| containing the following items:
accel menu item accelerator text |menu-text|
display display name (name without '&')
icon name of the icon file (for toolbar) |toolbar-icon|
modes |Dictionary| containing mode-specific
information for this menu item. See
below for more information. |map-modes|
name menu item name
priority menu order priority |menu-priority|
shortcut shortcut key (character after '&' in
the menu name) |menu-shortcut|
submenus |List| containing the properties of
all the submenus. Each list item is a
Dictionary with the above items.
Present only if the menu item has submenus.
The {modes} field is a |Dictionary| containing the following
fields:
enabled v:true if this menu item is enabled
Refer to |:menu-enable|
noremenu 1 if remapping in {rhs} is allowed.
2 if remapping in {rhs} is not allowed
3 if script-local remapping is allowed
See |:menu-script|
rhs right-hand-side of the menu item
silent v:true if the menu item is created
with <silent> argument |:menu-silent|
For a top-level menu, the {modes} field will not be present.
Returns an empty dictionary on error.
Examples: >
:echo menu_getprop('Edit.Cut')
:echo menu_getprop('File')
:echo menu_getprop()
<
Can also be used as a |method|: >
GetMenuName()->menu_getprop()
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/CAAW7x7nYxBofE0%2BqJEMRo%2B%2BGAa4v6A%3D4Yp8vzaodsZA%2BERvfkQ%40mail.gmail.com.