Home Explore Blog CI



neovim

13th chunk of `runtime/doc/gui.txt`
597d42dc9f497d1e3fb703c27869378acfb231e56dcfe4a30000000100000e69
 no argument is given after :menu at all, then ALL menu items are shown
for the appropriate mode (e.g., Command-line mode for :cmenu).

Special characters in the list, just before the rhs:
• * Menu was defined with "nore" to disallow remapping.
• & Menu was defined with "<script>" to allow remapping script-local mappings.
• s Menu was defined with "<silent>" to avoid showing what it is mapped to
    when triggered.
• - Menu was disabled.

Note that hitting <Tab> while entering a menu name after a menu command may
be used to complete the name of the menu item.


Executing Menus                                         *execute-menus*

                                                *:em*  *:emenu* *E334* *E335*
:[range]em[enu] {menu}          Execute {menu} from the command line.
                                The default is to execute the Normal mode
                                menu.  If a range is specified, it executes
                                the Visual mode menu.
                                If used from <c-o>, it executes the
                                insert-mode menu Eg: >
        :emenu File.Exit

:[range]em[enu] {mode} {menu}   Like above, but execute the menu for {mode}:
                                - 'n': |:nmenu|  Normal mode
                                - 'v': |:vmenu|  Visual mode
                                - 's': |:smenu|  Select mode
                                - 'o': |:omenu|  Operator-pending mode
                                - 't': |:tlmenu| Terminal mode
                                - 'i': |:imenu|  Insert mode
                                - 'c': |:cmenu|  Cmdline mode


You can use :emenu to access useful menu items you may have got used to from
GUI mode.  See 'wildmenu' for an option that works well with this.  See
|console-menus| for an example.

When using a range, if the lines match with '<,'>, then the menu is executed
using the last visual selection.


Deleting Menus                                          *delete-menus*

                                                *:unme*  *:unmenu*
                                                *:aun*   *:aunmenu*
To delete a menu item or a whole submenu, use the unmenu commands, which are
analogous to the unmap commands.  Eg: >
    :unmenu! Edit.Paste

This will remove the Paste item from the Edit menu for Insert and
Command-line modes.

Note that hitting <Tab> while entering a menu name after an umenu command
may be used to complete the name of the menu item for the appropriate mode.

To remove all menus use:                        *:unmenu-all*  >
        :unmenu *       " remove all menus in Normal and visual mode
        :unmenu! *      " remove all menus in Insert and Command-line mode
        :aunmenu *      " remove all menus in all modes, except for Terminal
                        " mode
        :tlunmenu *     " remove all menus in Terminal mode

If you want to get rid of the menu bar: >
        :set guioptions-=m


Disabling Menus                                         *disable-menus*

                                                *:menu-disable* *:menu-enable*
If you do not want to remove a menu, but disable it for a moment, this can be
done by adding the "enable" or "disable" keyword to a ":menu" command.
Examples: >
        :menu disable &File.&Open\.\.\.
        :amenu enable *
        :amenu disable &Tools.*

The command applies to the modes as used with all menu commands.  Note that
characters like "&" need to be included for translated names to be found.
When the argument is "*", all menus are affected.  Otherwise the given menu
name and all existing submenus below it are affected.

Title: Vim Menu Execution, Deletion, and Disabling
Summary
This section covers how to execute menus from the command line using `:emenu`, including specifying the mode and range. It explains how to delete menu items or entire submenus using `:unmenu`, and how to remove all menus for specific modes. Finally, it details how to temporarily disable menus using the `disable` keyword with the `:menu` command, allowing for selective menu control without permanent removal.