Home Explore Blog CI



neovim

15th chunk of `runtime/doc/gui.txt`
90969bb25f94c00f2b820dbbb446f3ce8360478d88dd57e10000000100000d13
 Words.<C-R>z<CR>
  :vmenu Words.Add\ Var         "zy:menu! Words.<C-R>z <C-R>z <CR>
  :vmenu Words.Remove\ Var      "zy:unmenu! Words.<C-R>z<CR>
  :imenu Words.Add\ Var         <Esc>wb"zye:menu! Words.<C-R>z <C-R>z<CR>a
  :imenu Words.Remove\ Var      <Esc>wb"zye:unmenu! Words.<C-R>z<CR>a

(the rhs is in <> notation, you can copy/paste this text to try out the
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.

                                                        *:tmenu*
:tm[enu] {menupath} {rhs}       Define a tip for a menu or tool.  (only in
                                X11 and Win32 GUI)

:tm[enu] [menupath]             List menu tips. (only in X11 and Win32 GUI)

                                                        *:tunmenu*
:tu[nmenu] {menupath}           Remove a tip for a menu or tool.
                                (only in X11 and Win32 GUI)

Note: To create menus for terminal mode, use |:tlmenu| instead.

When a tip is defined for a menu item, it appears in the command-line area
when the mouse is over that item, much like a standard Windows menu hint in
the status bar.  (Except when Vim is in Command-line mode, when of course
nothing is displayed.)
When a tip is defined for a ToolBar item, it appears as a tooltip when the
mouse pauses over that button, in the usual fashion.  Use the |hl-Tooltip|
highlight group to change its colors.

A "tip" can be defined for each menu item.  For example, when defining a menu
item like this: >
        :amenu MyMenu.Hello :echo "Hello"<CR>
The tip is defined like this: >
        :tmenu MyMenu.Hello Displays a greeting.
And delete it with: >
        :tunmenu MyMenu.Hello

Tooltips are currently only supported for the X11 and Win32 GUI.  However, they
should appear for the other gui platforms in the not too distant future.

The ":tmenu" command works just like other menu commands, it uses the same
arguments.  ":tunmenu" deletes an existing menu tip, in the same way as the
other unmenu commands.

If a menu item becomes invalid (i.e. its actions in all modes are deleted) Vim
deletes the menu tip (and the item) for you.  This means that :aunmenu deletes
a menu item - you don't need to do a :tunmenu as well.


5.9 Popup Menus

You can cause a menu to popup at the cursor.  This behaves similarly to the
PopUp menus except that any menu tree can be popped up.

                                                        *:popup* *:popu*
:popu[p] {name}                 Popup the menu {name}.  The menu named must
                                have at least one subentry, but need not
                                appear on the menu-bar (see |hidden-menus|).

:popu[p]! {name}                Like above, but use the position of the mouse
                                pointer instead of the cursor.

Example: >
        :popup File
will make the "File" menu (if there is one) appear at the text cursor (mouse
pointer if ! was used). >

        :amenu ]Toolbar.Make    :make<CR>
        :popup ]Toolbar
This creates a popup menu that doesn't exist on the main menu-bar.

Note that a menu that starts with ']' will not be displayed.


 vim:tw=78:sw=4:ts=8:et:ft=help:norl:

Title: Vim Menu Tooltips, Terminal Menus, and Popup Menus
Summary
This section explains how to define tooltips for menu items and toolbar buttons, which appear in the command-line area or as tooltips when the mouse hovers over them in X11 and Win32 GUI environments. It also describes the use of `:tlmenu` for creating menus in terminal mode. The section further details how to create and use popup menus using the `:popup` command, allowing any menu tree to be displayed at the cursor position or mouse pointer.