menu_change
menu_changepath [ -label “name”] [ -cmd {cmds}] [ -keykeyname | -keytext [ “text” | none | default]] [ -active [“actexpr”] | -inactive] [ -toggle 'togexpr']
This command changes an existing menu item. mch is a synonym for menu_change.
• path is the menu path of the menu item to be changed.
• -label “name” changes the label displayed for the item. If name contains any variable references, for example, -label "Modify $tagname", the variable reference is substituted into the label string each time the menu containing the item is posted. Note, the label string name must be enclosed in single quotes to prevent the command parser from expanding the variable reference when the command is parsed.
|
Underscores, spaces, and periods are not allowed in menu bar labels.
|
• -cmd {cmds} changes the command(s) associated with the menu item. The command must be enclosed in curly braces. Multiple commands are separated by semicolons.
• -keykeyname changes the accelerator key text displayed in the right-hand field of the menu item. See map for a list of possible values for keyname. keyname is abbreviated to reduce the size of the menu. For example, -key control-z is displayed as Ctrl+Z.
|
Specifying a keyname does not actually map the specified key combination to the menu item. You must use the map command to associate a user function to a key.
|
• -keytext has three options, -keytext"text", -keytext none and -keytext default.
◦ -keytext "text" changes the accelerator key text displayed in the right-hand field of the menu item
◦ -keytext none means no accelerator is shown.
◦ -keytext default restores the default keyboard accelerator. You may want to use it following a menu_change-keytext none command.
The -keytext option is similar to the -key option except that the accelerator text is specified directly by text instead of by a keyname. Because the -keytext option requires more memory, the -key option is preferred. However, -keytext is useful for turning off accelerator text (using none) and also for menu items mapped to multiple keys, for example, using prefix keymaps, since -key only allows a single key to be specified.
• -active ['actexpr'] specifies an expression to be evaluated when the menu is posted that determines whether the menu item is enabled or disabled (grayed-out). If the expression evaluates to non-zero the menu item is selectable, otherwise, the menu item is unavailable. If actexpr is omitted, the menu item is made active unconditionally.
• -inactive specifies that the menu item be made insensitive (grayed-out). The item remains unavailable until a subsequent menu_change command enables it with the -active option. If the menu item is enabled using the -active option, it is still subject to be unavailable when posted (according to the context of the cursor). This context-sensitive graying is done only for menu items mapped to simple commands, such as delete_mark, insert_tag, undo. The optional string argument actexpr specifies an expression to be evaluated when the menu is posted. That determines whether the menu item is enabled or disabled (grayed-out). If the expression evaluates to non-zero, the menu item is selectable, otherwise, the menu item is grayed-out.
• -toggle 'togexpr' changes the -cmd menu item into a toggle item, which displays a check mark if set. The string argument togexpr specifies an expression to be evaluated when the menu is posted. If it evaluates to non-zero the menu item will be displayed with a check mark, otherwise, the check mark will be removed.
Examples
menu_change .File.Print -inactive
mch :EditPopup.Paste -key control-y
mch ".Options.Full Menus" -check
mch ".File.Preview.Current*" -label " to end"
Related Topics