Home Explore Blog CI



neovim

5th chunk of `runtime/doc/usr_42.txt`
e3d7e71ffec5ec579d4b6d2237737bedfb4b3a2463fd222e0000000100000d3b
 changes, throw them away or cancel the command.
   For more complicated items, the confirm() and inputdialog() functions can
be used.  The default menus contain a few examples.

==============================================================================
*42.4*	Toolbar and popup menus

There are two special menus: ToolBar and PopUp.  Items that start with these
names do not appear in the normal menu bar.


TOOLBAR

The toolbar appears only when the "T" flag is included in the 'guioptions'
option.
   The toolbar uses icons rather than text to represent the command.  For
example, the {menu-item} named "ToolBar.New" causes the "New" icon to appear
on the toolbar.
   The Vim editor has 28 built-in icons.  You can find a table here:
|builtin-tools|.  Most of them are used in the default toolbar.  You can
redefine what these items do (after the default menus are setup).
   You can add another bitmap for a toolbar item.  Or define a new toolbar
item with a bitmap.  For example, define a new toolbar item with: >

	:tmenu ToolBar.Compile  Compile the current file
	:amenu ToolBar.Compile  :!cc %:S -o %:r:S<CR>

Now you need to create the icon.  For MS-Windows it must be in bitmap format,
with the name "Compile.bmp".  For Unix XPM format is used, the file name is
"Compile.xpm".  The size must be 18 by 18 pixels.  On MS-Windows other sizes
can be used as well, but it will look ugly.
   Put the bitmap in the directory "bitmaps" in one of the directories from
'runtimepath'.  E.g., for Unix "~/.config/nvim/bitmaps/Compile.xpm".

You can define tooltips for the items in the toolbar.  A tooltip is a short
text that explains what a toolbar item will do.  For example "Open file".  It
appears when the mouse pointer is on the item, without moving for a moment.
This is very useful if the meaning of the picture isn't that obvious.
Example: >

	:tmenu ToolBar.Make  Run make in the current directory
<
	Note:
	Pay attention to the case used.  "Toolbar" and "toolbar" are different
	from "ToolBar"!

To remove a tooltip, use the |:tunmenu| command.

The 'toolbar' option can be used to display text instead of a bitmap, or both
text and a bitmap.  Most people use just the bitmap, since the text takes
quite a bit of space.


POPUP MENU

The popup menu pops up where the mouse pointer is.  On MS-Windows you activate
it by clicking the right mouse button.  Then you can select an item with the
left mouse button.  On Unix the popup menu is used by pressing and holding the
right mouse button.
   The popup menu only appears when the 'mousemodel' has been set to "popup"
or "popup_setpos".  The difference between the two is that "popup_setpos"
moves the cursor to the mouse pointer position.  When clicking inside a
selection, the selection will be used unmodified.  When there is a selection
but you click outside of it, the selection is removed.
   There is a separate popup menu for each mode.  Thus there are never grey
items like in the normal menus.

What is the meaning of life, the universe and everything?  *42*
Douglas Adams, the only person who knew what this question really was about is
now dead, unfortunately.  So now you might wonder what the meaning of death
is...

==============================================================================

Next chapter: |usr_43.txt|  Using filetypes

Copyright: see |manual-copyright|  vim:tw=78:ts=8:noet:ft=help:norl:

Title: Toolbar and Popup Menus: Customization and Functionality
Summary
This section explains how to customize the toolbar and popup menus in Vim. For the toolbar, you can add new items with icons (bitmaps for MS-Windows, XPM for Unix), define tooltips, and control the display of text vs. bitmaps using the 'toolbar' option. The popup menu is activated via the right mouse button and requires setting 'mousemodel' to "popup" or "popup_setpos". Each mode has its own popup menu. The section also references |usr_43.txt| for filetype usage and the copyright information.