gui.txt 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. *gui.txt* Nvim
  2. VIM REFERENCE MANUAL by Bram Moolenaar
  3. Nvim Graphical User Interface *gui* *GUI*
  4. Type |gO| to see the table of contents.
  5. ==============================================================================
  6. Starting the GUI *gui-start* *E229* *E233*
  7. *ginit.vim* *gui-init* *gvimrc* *$MYGVIMRC*
  8. For GUI-specific configuration Nvim provides the |UIEnter| event. This
  9. happens after other |initialization|s, like reading your vimrc file.
  10. Example: this sets "g:gui" to the value of the UI's "rgb" field: >
  11. :autocmd UIEnter * let g:gui = filter(nvim_list_uis(),{k,v-> v.chan==v:event.chan})[0].rgb
  12. <
  13. *:winp* *:winpos* *E188*
  14. :winp[os]
  15. Display current position of the top left corner of the GUI vim
  16. window in pixels. Does not work in all versions.
  17. Also see |getwinpos()|, |getwinposx()| and |getwinposy()|.
  18. :winp[os] {X} {Y} *E466*
  19. Put the GUI vim window at the given {X} and {Y} coordinates.
  20. The coordinates should specify the position in pixels of the
  21. top left corner of the window.
  22. When the GUI window has not been opened yet, the values are
  23. remembered until the window is opened. The position is
  24. adjusted to make the window fit on the screen (if possible).
  25. *:win* *:winsize* *E465*
  26. :win[size] {width} {height}
  27. Set the window height to {width} by {height} characters.
  28. Obsolete, use ":set lines=11 columns=22".
  29. ==============================================================================
  30. Scrollbars *gui-scrollbars*
  31. There are vertical scrollbars and a horizontal scrollbar. You may
  32. configure which ones appear with the 'guioptions' option.
  33. The interface looks like this (with ":set guioptions=mlrb"):
  34. +------------------------------+ `
  35. | File Edit Help | <- Menu bar (m) `
  36. +-+--------------------------+-+ `
  37. |^| |^| `
  38. |#| Text area. |#| `
  39. | | | | `
  40. |v|__________________________|v| `
  41. Normal status line -> |-+ File.c 5,2 +-| `
  42. between Vim windows |^|""""""""""""""""""""""""""|^| `
  43. | | | | `
  44. | | Another file buffer. | | `
  45. | | | | `
  46. |#| |#| `
  47. Left scrollbar (l) -> |#| |#| <- Right `
  48. |#| |#| scrollbar (r) `
  49. | | | | `
  50. |v| |v| `
  51. +-+--------------------------+-+ `
  52. | |< #### >| | <- Bottom `
  53. +-+--------------------------+-+ scrollbar (b) `
  54. Any of the scrollbar or menu components may be turned off by not putting the
  55. appropriate letter in the 'guioptions' string. The bottom scrollbar is
  56. only useful when 'nowrap' is set.
  57. VERTICAL SCROLLBARS *gui-vert-scroll*
  58. Each Vim window has a scrollbar next to it which may be scrolled up and down
  59. to move through the text in that buffer. The size of the scrollbar-thumb
  60. indicates the fraction of the buffer which can be seen in the window.
  61. When the scrollbar is dragged all the way down, the last line of the file
  62. will appear in the top of the window.
  63. If a window is shrunk to zero height (by the growth of another window) its
  64. scrollbar disappears. It reappears when the window is restored.
  65. If a window is vertically split, it will get a scrollbar when it is the
  66. current window and when, taking the middle of the current window and drawing a
  67. vertical line, this line goes through the window.
  68. When there are scrollbars on both sides, and the middle of the current window
  69. is on the left half, the right scrollbar column will contain scrollbars for
  70. the rightmost windows. The same happens on the other side.
  71. HORIZONTAL SCROLLBARS *gui-horiz-scroll*
  72. The horizontal scrollbar (at the bottom of the Vim GUI) may be used to
  73. scroll text sideways when the 'wrap' option is turned off. The
  74. scrollbar-thumb size is such that the text of the longest visible line may be
  75. scrolled as far as possible left and right. The cursor is moved when
  76. necessary, it must remain on a visible character (unless 'virtualedit' is
  77. set).
  78. Computing the length of the longest visible line takes quite a bit of
  79. computation, and it has to be done every time something changes. If this
  80. takes too much time or you don't like the cursor jumping to another line,
  81. include the 'h' flag in 'guioptions'. Then the scrolling is limited by the
  82. text of the current cursor line.
  83. ==============================================================================
  84. Drag and drop *drag-n-drop*
  85. You can drag and drop one or more files into the Vim window, where they will
  86. be opened as if a |:drop| command was used.
  87. If you hold down Shift while doing this, Vim changes to the first dropped
  88. file's directory. If you hold Ctrl Vim will always split a new window for the
  89. file. Otherwise it's only done if the current buffer has been changed.
  90. You can also drop a directory on Vim. This starts the explorer plugin for
  91. that directory (assuming it was enabled, otherwise you'll get an error
  92. message). Keep Shift pressed to change to the directory instead.
  93. If Vim happens to be editing a command line, the names of the dropped files
  94. and directories will be inserted at the cursor. This allows you to use these
  95. names with any Ex command. Special characters (space, tab, double quote and
  96. '|'; backslash on non-MS-Windows systems) will be escaped.
  97. ==============================================================================
  98. Menus *menus*
  99. For an introduction see |usr_42.txt| in the user manual.
  100. Using Menus *using-menus*
  101. Basically, menus can be used just like mappings. You can define your own
  102. menus, as many as you like.
  103. Long-time Vim users won't use menus much. But the power is in adding your own
  104. menus and menu items. They are most useful for things that you can't remember
  105. what the key sequence was.
  106. For creating menus in a different language, see |:menutrans|.
  107. If you don't want to use menus at all, see |'go-M'|.
  108. *menu.vim*
  109. The default menus are read from the file "$VIMRUNTIME/menu.vim". See
  110. |$VIMRUNTIME| for where the path comes from. You can set up your own menus.
  111. Starting off with the default set is a good idea. You can add more items, or,
  112. if you don't like the defaults at all, start with removing all menus
  113. |:unmenu-all|. You can also avoid the default menus being loaded by adding
  114. this line to your vimrc file (NOT your gvimrc file!): >
  115. :let did_install_default_menus = 1
  116. If you also want to avoid the Syntax menu: >
  117. :let did_install_syntax_menu = 1
  118. The first item in the Syntax menu can be used to show all available filetypes
  119. in the menu (which can take a bit of time to load). If you want to have all
  120. filetypes already present at startup, add: >
  121. :let do_syntax_sel_menu = 1
  122. Note that the menu.vim is sourced when `:syntax on` or `:filetype on` is
  123. executed or after your .vimrc file is sourced. This means that the 'encoding'
  124. option and the language of messages (`:language messages`) must be set before
  125. that (if you want to change them).
  126. *console-menus*
  127. Although this documentation is in the GUI section, you can actually use menus
  128. in console mode too. You will have to load |menu.vim| explicitly then, it is
  129. not done by default. You can use the |:emenu| command and command-line
  130. completion with 'wildmenu' to access the menu entries almost like a real menu
  131. system. To do this, put these commands in your vimrc file: >
  132. :source $VIMRUNTIME/menu.vim
  133. :set wildmenu
  134. :set cpo-=<
  135. :set wcm=<C-Z>
  136. :map <F4> :emenu <C-Z>
  137. Pressing <F4> will start the menu. You can now use the cursor keys to select
  138. a menu entry. Hit <Enter> to execute it. Hit <Esc> if you want to cancel.
  139. Creating New Menus *creating-menus*
  140. *:me* *:menu* *:noreme* *:noremenu*
  141. *E330* *E327* *E331* *E336* *E333*
  142. *E328* *E329* *E337* *E792*
  143. To create a new menu item, use the ":menu" commands. They are mostly like
  144. the ":map" set of commands (see |map-modes|), but the first argument is a menu
  145. item name, given as a path of menus and submenus with a '.' between them,
  146. e.g.: >
  147. :menu File.Save :w<CR>
  148. :inoremenu File.Save <C-O>:w<CR>
  149. :menu Edit.Big\ Changes.Delete\ All\ Spaces :%s/[ ^I]//g<CR>
  150. This last one will create a new item in the menu bar called "Edit", holding
  151. the mouse button down on this will pop up a menu containing the item
  152. "Big Changes", which is a sub-menu containing the item "Delete All Spaces",
  153. which when selected, performs the operation.
  154. To create a menu for terminal mode, use |:tlmenu| instead of |:tmenu| unlike
  155. key mapping (|:tmap|). This is because |:tmenu| is already used for defining
  156. tooltips for menus. See |terminal-input|.
  157. Special characters in a menu name:
  158. *menu-shortcut*
  159. & The next character is the shortcut key. Make sure each
  160. shortcut key is only used once in a (sub)menu. If you want to
  161. insert a literal "&" in the menu name use "&&".
  162. *menu-text*
  163. <Tab> Separates the menu name from right-aligned text. This can be
  164. used to show the equivalent typed command. The text "<Tab>"
  165. can be used here for convenience. If you are using a real
  166. tab, don't forget to put a backslash before it!
  167. Example: >
  168. :amenu &File.&Open<Tab>:e :browse e<CR>
  169. [typed literally]
  170. With the shortcut "F" (while keeping the <Alt> key pressed), and then "O",
  171. this menu can be used. The second part is shown as "Open :e". The ":e"
  172. is right aligned, and the "O" is underlined, to indicate it is the shortcut.
  173. *:am* *:amenu* *:an* *:anoremenu*
  174. The ":amenu" command can be used to define menu entries for all modes at once,
  175. expect for Terminal mode. To make the command work correctly, a character is
  176. automatically inserted for some modes:
  177. mode inserted appended ~
  178. Normal nothing nothing
  179. Visual <C-C> <C-\><C-G>
  180. Insert <C-\><C-O>
  181. Cmdline <C-C> <C-\><C-G>
  182. Op-pending <C-C> <C-\><C-G>
  183. Example: >
  184. :amenu File.Next :next^M
  185. is equal to: >
  186. :nmenu File.Next :next^M
  187. :vmenu File.Next ^C:next^M^\^G
  188. :imenu File.Next ^\^O:next^M
  189. :cmenu File.Next ^C:next^M^\^G
  190. :omenu File.Next ^C:next^M^\^G
  191. Careful: In Insert mode this only works for a SINGLE Normal mode command,
  192. because of the CTRL-O. If you have two or more commands, you will need to use
  193. the ":imenu" command. For inserting text in any mode, you can use the
  194. expression register: >
  195. :amenu Insert.foobar "='foobar'<CR>P
  196. The special text <Cmd> begins a "command menu", it executes the command
  197. directly without changing modes. Where you might use ":...<CR>" you can
  198. instead use "<Cmd>...<CR>". See |<Cmd>| for more info. Example: >
  199. anoremenu File.Next <Cmd>next<CR>
  200. Note that <Esc> in Cmdline mode executes the command, like in a mapping. This
  201. is Vi compatible. Use CTRL-C to quit Cmdline mode.
  202. *:nme* *:nmenu* *:nnoreme* *:nnoremenu* *:nunme* *:nunmenu*
  203. Menu commands starting with "n" work in Normal mode. |mapmode-n|
  204. *:ome* *:omenu* *:onoreme* *:onoremenu* *:ounme* *:ounmenu*
  205. Menu commands starting with "o" work in Operator-pending mode. |mapmode-o|
  206. *:vme* *:vmenu* *:vnoreme* *:vnoremenu* *:vunme* *:vunmenu*
  207. Menu commands starting with "v" work in Visual mode. |mapmode-v|
  208. *:xme* *:xmenu* *:xnoreme* *:xnoremenu* *:xunme* *:xunmenu*
  209. Menu commands starting with "x" work in Visual and Select mode. |mapmode-x|
  210. *:sme* *:smenu* *:snoreme* *:snoremenu* *:sunme* *:sunmenu*
  211. Menu commands starting with "s" work in Select mode. |mapmode-s|
  212. *:ime* *:imenu* *:inoreme* *:inoremenu* *:iunme* *:iunmenu*
  213. Menu commands starting with "i" work in Insert mode. |mapmode-i|
  214. *:cme* *:cmenu* *:cnoreme* *:cnoremenu* *:cunme* *:cunmenu*
  215. Menu commands starting with "c" work in Cmdline mode. |mapmode-c|
  216. *:tlm* *:tlmenu* *:tln* *:tlnoremenu* *:tlu* *:tlunmenu*
  217. Menu commands starting with "tl" work in Terminal mode. |mapmode-t|
  218. *:menu-<silent>* *:menu-silent*
  219. To define a menu which will not be echoed on the command line, add
  220. "<silent>" as the first argument. Example: >
  221. :menu <silent> Settings.Ignore\ case :set ic<CR>
  222. The ":set ic" will not be echoed when using this menu. Messages from the
  223. executed command are still given though. To shut them up too, add a ":silent"
  224. in the executed command: >
  225. :menu <silent> Search.Header :exe ":silent normal /Header\r"<CR>
  226. "<silent>" may also appear just after "<script>".
  227. *:menu-<script>* *:menu-script*
  228. The "to" part of the menu will be inspected for mappings. If you don't want
  229. this, use the ":noremenu" command (or the similar one for a specific mode).
  230. If you do want to use script-local mappings, add "<script>" as the very first
  231. argument to the ":menu" command or just after "<silent>".
  232. *menu-priority*
  233. You can give a priority to a menu. Menus with a higher priority go more to
  234. the right. The priority is given as a number before the ":menu" command.
  235. Example: >
  236. :80menu Buffer.next :bn<CR>
  237. The default menus have these priorities:
  238. File 10
  239. Edit 20
  240. Tools 40
  241. Syntax 50
  242. Buffers 60
  243. Window 70
  244. Help 9999
  245. When no or zero priority is given, 500 is used.
  246. The priority for the PopUp menu is not used.
  247. You can use a priority higher than 9999, to make it go after the Help menu,
  248. but that is non-standard and is discouraged. The highest possible priority is
  249. about 32000. The lowest is 1.
  250. *sub-menu-priority*
  251. The same mechanism can be used to position a sub-menu. The priority is then
  252. given as a dot-separated list of priorities, before the menu name: >
  253. :menu 80.500 Buffer.next :bn<CR>
  254. Giving the sub-menu priority is only needed when the item is not to be put
  255. in a normal position. For example, to put a sub-menu before the other items: >
  256. :menu 80.100 Buffer.first :brew<CR>
  257. Or to put a sub-menu after the other items, and further items with default
  258. priority will be put before it: >
  259. :menu 80.900 Buffer.last :blast<CR>
  260. When a number is missing, the default value 500 will be used: >
  261. :menu .900 myMenu.test :echo "text"<CR>
  262. The menu priority is only used when creating a new menu. When it already
  263. existed, e.g., in another mode, the priority will not change. Thus, the
  264. priority only needs to be given the first time a menu is used.
  265. An exception is the PopUp menu. There is a separate menu for each mode
  266. (Normal, Op-pending, Visual, Insert, Cmdline). The order in each of these
  267. menus can be different. This is different from menu-bar menus, which have
  268. the same order for all modes.
  269. NOTE: sub-menu priorities currently don't work for all versions of the GUI.
  270. *menu-separator* *E332*
  271. Menu items can be separated by a special item that inserts some space between
  272. items. Depending on the system this is displayed as a line or a dotted line.
  273. These items must start with a '-' and end in a '-'. The part in between is
  274. used to give it a unique name. Priorities can be used as with normal items.
  275. Example: >
  276. :menu Example.item1 :do something
  277. :menu Example.-Sep- :
  278. :menu Example.item2 :do something different
  279. Note that the separator also requires a rhs. It doesn't matter what it is,
  280. because the item will never be selected. Use a single colon to keep it
  281. simple.
  282. *gui-toolbar*
  283. The default toolbar is setup in menu.vim. The display of the toolbar is
  284. controlled by the 'guioptions' letter 'T'. You can thus have menu & toolbar
  285. together, or either on its own, or neither. The appearance is controlled by
  286. the 'toolbar' option. You can choose between an image, text or both.
  287. *toolbar-icon*
  288. The toolbar is defined as a special menu called ToolBar, which only has one
  289. level. Vim interprets the items in this menu as follows:
  290. 1) If an "icon=" argument was specified, the file with this name is used.
  291. The file can either be specified with the full path or with the base name.
  292. In the last case it is searched for in the "bitmaps" directory in
  293. 'runtimepath', like in point 3. Examples: >
  294. :amenu icon=/usr/local/pixmaps/foo_icon.xpm ToolBar.Foo :echo "Foo"<CR>
  295. :amenu icon=FooIcon ToolBar.Foo :echo "Foo"<CR>
  296. < Note that in the first case the extension is included, while in the second
  297. case it is omitted.
  298. If the file cannot be opened the next points are tried.
  299. A space in the file name must be escaped with a backslash.
  300. A menu priority must come _after_ the icon argument: >
  301. :amenu icon=foo 1.42 ToolBar.Foo :echo "42!"<CR>
  302. 2) An item called 'BuiltIn##', where ## is a number, is taken as number ## of
  303. the built-in bitmaps available in Vim. Currently there are 31 numbered
  304. from 0 to 30 which cover most common editing operations |builtin-tools|. >
  305. :amenu ToolBar.BuiltIn22 :call SearchNext("back")<CR>
  306. 3) An item with another name is first searched for in the directory
  307. "bitmaps" in 'runtimepath'. If found, the bitmap file is used as the
  308. toolbar button image. Note that the exact filename is OS-specific: For
  309. example, under Win32 the command >
  310. :amenu ToolBar.Hello :echo "hello"<CR>
  311. < would find the file 'hello.bmp'. Under X11 it is 'Hello.xpm'.
  312. For MS-Windows and the bitmap is scaled to fit the button. For
  313. MS-Windows a size of 18 by 18 pixels works best.
  314. For MS-Windows the bitmap should have 16 colors with the standard palette.
  315. The light grey pixels will be changed to the Window frame color and the
  316. dark grey pixels to the window shadow color. More colors might also work,
  317. depending on your system.
  318. 4) If the bitmap is still not found, Vim checks for a match against its list
  319. of built-in names. Each built-in button image has a name.
  320. So the command >
  321. :amenu ToolBar.Open :e
  322. < will show the built-in "open a file" button image if no open.bmp exists.
  323. All the built-in names can be seen used in menu.vim.
  324. 5) If all else fails, a blank, but functioning, button is displayed.
  325. *builtin-tools*
  326. nr Name Normal action ~
  327. 00 New open new window
  328. 01 Open browse for file to open in current window
  329. 02 Save write buffer to file
  330. 03 Undo undo last change
  331. 04 Redo redo last undone change
  332. 05 Cut delete selected text to clipboard
  333. 06 Copy copy selected text to clipboard
  334. 07 Paste paste text from clipboard
  335. 08 Print print current buffer
  336. 09 Help open a buffer on Vim's builtin help
  337. 10 Find start a search command
  338. 11 SaveAll write all modified buffers to file
  339. 12 SaveSesn write session file for current situation
  340. 13 NewSesn write new session file
  341. 14 LoadSesn load session file
  342. 15 RunScript browse for file to run as a Vim script
  343. 16 Replace prompt for substitute command
  344. 17 WinClose close current window
  345. 18 WinMax make current window use many lines
  346. 19 WinMin make current window use few lines
  347. 20 WinSplit split current window
  348. 21 Shell start a shell
  349. 22 FindPrev search again, backward
  350. 23 FindNext search again, forward
  351. 24 FindHelp prompt for word to search help for
  352. 25 Make run make and jump to first error
  353. 26 TagJump jump to tag under the cursor
  354. 27 RunCtags build tags for files in current directory
  355. 28 WinVSplit split current window vertically
  356. 29 WinMaxWidth make current window use many columns
  357. 30 WinMinWidth make current window use few columns
  358. *hidden-menus* *win32-hidden-menus*
  359. In the Win32 GUI, starting a menu name with ']' excludes that menu from the
  360. main menu bar. You must then use the |:popup| command to display it.
  361. When splitting the window the window toolbar is not copied to the new window.
  362. *popup-menu*
  363. You can define the special menu "PopUp". This is the menu that is displayed
  364. when the right mouse button is pressed, if 'mousemodel' is set to popup or
  365. popup_setpos.
  366. The default "PopUp" menu is: >
  367. aunmenu PopUp
  368. vnoremenu PopUp.Cut "+x
  369. vnoremenu PopUp.Copy "+y
  370. anoremenu PopUp.Paste "+gP
  371. vnoremenu PopUp.Paste "+P
  372. vnoremenu PopUp.Delete "_x
  373. nnoremenu PopUp.Select\ All> ggVG
  374. vnoremenu PopUp.Select\ All> gg0oG$
  375. inoremenu PopUp.Select\ All <C-Home><C-O>VG
  376. anoremenu PopUp.-1- <Nop>
  377. anoremenu PopUp.How-to\ disable\ mouse <Cmd>help disable-mouse<CR>
  378. <
  379. Showing What Menus Are Mapped To *showing-menus*
  380. To see what an existing menu is mapped to, use just one argument after the
  381. menu commands (just like you would with the ":map" commands). If the menu
  382. specified is a submenu, then all menus under that hierarchy will be shown.
  383. If no argument is given after :menu at all, then ALL menu items are shown
  384. for the appropriate mode (e.g., Command-line mode for :cmenu).
  385. Special characters in the list, just before the rhs:
  386. * The menu was defined with "nore" to disallow remapping.
  387. & The menu was defined with "<script>" to allow remapping script-local
  388. mappings only.
  389. s The menu was defined with "<silent>" to avoid showing what it is
  390. mapped to when triggered.
  391. - The menu was disabled.
  392. Note that hitting <Tab> while entering a menu name after a menu command may
  393. be used to complete the name of the menu item.
  394. Executing Menus *execute-menus*
  395. *:em* *:emenu* *E334* *E335*
  396. :[range]em[enu] {menu} Execute {menu} from the command line.
  397. The default is to execute the Normal mode
  398. menu. If a range is specified, it executes
  399. the Visual mode menu.
  400. If used from <c-o>, it executes the
  401. insert-mode menu Eg: >
  402. :emenu File.Exit
  403. :[range]em[enu] {mode} {menu} Like above, but execute the menu for {mode}:
  404. 'n': |:nmenu| Normal mode
  405. 'v': |:vmenu| Visual mode
  406. 's': |:smenu| Select mode
  407. 'o': |:omenu| Operator-pending mode
  408. 't': |:tlmenu| Terminal mode
  409. 'i': |:imenu| Insert mode
  410. 'c': |:cmenu| Cmdline mode
  411. You can use :emenu to access useful menu items you may have got used to from
  412. GUI mode. See 'wildmenu' for an option that works well with this. See
  413. |console-menus| for an example.
  414. When using a range, if the lines match with '<,'>, then the menu is executed
  415. using the last visual selection.
  416. Deleting Menus *delete-menus*
  417. *:unme* *:unmenu*
  418. *:aun* *:aunmenu*
  419. To delete a menu item or a whole submenu, use the unmenu commands, which are
  420. analogous to the unmap commands. Eg: >
  421. :unmenu! Edit.Paste
  422. This will remove the Paste item from the Edit menu for Insert and
  423. Command-line modes.
  424. Note that hitting <Tab> while entering a menu name after an umenu command
  425. may be used to complete the name of the menu item for the appropriate mode.
  426. To remove all menus use: *:unmenu-all* >
  427. :unmenu * " remove all menus in Normal and visual mode
  428. :unmenu! * " remove all menus in Insert and Command-line mode
  429. :aunmenu * " remove all menus in all modes, except for Terminal
  430. " mode
  431. :tlunmenu * " remove all menus in Terminal mode
  432. If you want to get rid of the menu bar: >
  433. :set guioptions-=m
  434. Disabling Menus *disable-menus*
  435. *:menu-disable* *:menu-enable*
  436. If you do not want to remove a menu, but disable it for a moment, this can be
  437. done by adding the "enable" or "disable" keyword to a ":menu" command.
  438. Examples: >
  439. :menu disable &File.&Open\.\.\.
  440. :amenu enable *
  441. :amenu disable &Tools.*
  442. The command applies to the modes as used with all menu commands. Note that
  443. characters like "&" need to be included for translated names to be found.
  444. When the argument is "*", all menus are affected. Otherwise the given menu
  445. name and all existing submenus below it are affected.
  446. Examples for Menus *menu-examples*
  447. Here is an example on how to add menu items with menu's! You can add a menu
  448. item for the keyword under the cursor. The register "z" is used. >
  449. :nmenu Words.Add\ Var wb"zye:menu! Words.<C-R>z <C-R>z<CR>
  450. :nmenu Words.Remove\ Var wb"zye:unmenu! Words.<C-R>z<CR>
  451. :vmenu Words.Add\ Var "zy:menu! Words.<C-R>z <C-R>z <CR>
  452. :vmenu Words.Remove\ Var "zy:unmenu! Words.<C-R>z<CR>
  453. :imenu Words.Add\ Var <Esc>wb"zye:menu! Words.<C-R>z <C-R>z<CR>a
  454. :imenu Words.Remove\ Var <Esc>wb"zye:unmenu! Words.<C-R>z<CR>a
  455. (the rhs is in <> notation, you can copy/paste this text to try out the
  456. mappings, or put these lines in your gvimrc; "<C-R>" is CTRL-R, "<CR>" is
  457. the <CR> key. |<>|)
  458. *tooltips* *menu-tips*
  459. Tooltips & Menu tips
  460. See section |42.4| in the user manual.
  461. *:tmenu*
  462. :tm[enu] {menupath} {rhs} Define a tip for a menu or tool. {only in
  463. X11 and Win32 GUI}
  464. :tm[enu] [menupath] List menu tips. {only in X11 and Win32 GUI}
  465. *:tunmenu*
  466. :tu[nmenu] {menupath} Remove a tip for a menu or tool.
  467. {only in X11 and Win32 GUI}
  468. Note: To create menus for terminal mode, use |:tlmenu| instead.
  469. When a tip is defined for a menu item, it appears in the command-line area
  470. when the mouse is over that item, much like a standard Windows menu hint in
  471. the status bar. (Except when Vim is in Command-line mode, when of course
  472. nothing is displayed.)
  473. When a tip is defined for a ToolBar item, it appears as a tooltip when the
  474. mouse pauses over that button, in the usual fashion. Use the |hl-Tooltip|
  475. highlight group to change its colors.
  476. A "tip" can be defined for each menu item. For example, when defining a menu
  477. item like this: >
  478. :amenu MyMenu.Hello :echo "Hello"<CR>
  479. The tip is defined like this: >
  480. :tmenu MyMenu.Hello Displays a greeting.
  481. And delete it with: >
  482. :tunmenu MyMenu.Hello
  483. Tooltips are currently only supported for the X11 and Win32 GUI. However, they
  484. should appear for the other gui platforms in the not too distant future.
  485. The ":tmenu" command works just like other menu commands, it uses the same
  486. arguments. ":tunmenu" deletes an existing menu tip, in the same way as the
  487. other unmenu commands.
  488. If a menu item becomes invalid (i.e. its actions in all modes are deleted) Vim
  489. deletes the menu tip (and the item) for you. This means that :aunmenu deletes
  490. a menu item - you don't need to do a :tunmenu as well.
  491. 5.9 Popup Menus
  492. You can cause a menu to popup at the cursor. This behaves similarly to the
  493. PopUp menus except that any menu tree can be popped up.
  494. This command is for backwards compatibility, using it is discouraged, because
  495. it behaves in a strange way.
  496. *:popup* *:popu*
  497. :popu[p] {name} Popup the menu {name}. The menu named must
  498. have at least one subentry, but need not
  499. appear on the menu-bar (see |hidden-menus|).
  500. :popu[p]! {name} Like above, but use the position of the mouse
  501. pointer instead of the cursor.
  502. Example: >
  503. :popup File
  504. will make the "File" menu (if there is one) appear at the text cursor (mouse
  505. pointer if ! was used). >
  506. :amenu ]Toolbar.Make :make<CR>
  507. :popup ]Toolbar
  508. This creates a popup menu that doesn't exist on the main menu-bar.
  509. Note that a menu that starts with ']' will not be displayed.
  510. vim:tw=78:sw=4:ts=8:noet:ft=help:norl: