home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vim53os2.zip / vim-5.3 / doc / gui.txt < prev    next >
Text File  |  1998-08-30  |  27KB  |  645 lines

  1. *gui.txt*       For Vim version 5.3.  Last modification: 1998 Aug 24
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Vim's Graphical User Interface                *gui* *GUI*
  8.  
  9. 1. Starting the GUI        |gui-start|
  10. 2. Scrollbars            |gui-scrollbars|
  11. 3. Mouse Control        |gui-mouse|
  12. 4. Making GUI Selections    |gui-selections|
  13. 5. Menus            |gui-menus|
  14. 6. Extras            |gui-extras|
  15. 7. Shell Commands        |gui-shell|
  16.  
  17. Other GUI documentation:
  18. |gui_x11.txt|    For specific items of the X11 GUI.
  19. |gui_w32.txt|    For specific items of the Win32 GUI.
  20.  
  21. {Vi does not have any of these commands}
  22.  
  23. ==============================================================================
  24. 1. Starting the GUI                    *gui-start*
  25.  
  26. First you must make sure you actually have a version of Vim with the GUI code
  27. included.  You can check this with the ":version" command, it should include
  28. "+GUI_Motif", "+GUI_Athena" or "+GUI_win32".
  29.  
  30. How to start the GUI depends on the system used.  Mostly you can can run the
  31. GUI version of Vim with:
  32.     gvim [options] [files...]
  33.  
  34. The X11 version of Vim can run both in GUI and in non-GUI mode.  See
  35. |gui-x11-start|.
  36.  
  37.                     *gui-init* *gvimrc* *.gvimrc* *_gvimrc*
  38. When the GUI starts up initializations are carried out, in this order:
  39. - If the system menu file exists, it is sourced.  The name of this file is
  40.   normally "$VIM/menu.vim".  You can check this with ":version".  Also
  41.   see |$VIM|.
  42. - If the "-U {gvimrc}" command-line option has been used when starting Vim,
  43.   the {gvimrc} file will be read for initializations.  The following
  44.   initializations are skipped.
  45. - For Unix, if the system gvimrc exists, it is sourced.  The name of this file
  46.   is normally "$VIM/gvimrc".  You can check this with ":version".  Also see
  47.   |$VIM|.
  48. - The following are tried, and only the first one that exists is used:
  49.   - If the GVIMINIT environment variable exists and is not empty, it is
  50.     executed as an Ex command.
  51.   - If the user gvimrc file exists, it is sourced.  The name of this file is
  52.     normally "$HOME/.gvimrc".  You can check this with ":version".
  53.   - For Win32, when $HOME is not set, "$VIM\_gvimrc" is used.
  54.   - When a "_gvimrc" file is not found, ".gvimrc" is tried too.  And vice
  55.     versa.
  56. - If the 'exrc' option is set (which is NOT the default) the file ./.gvimrc
  57.   is sourced, if it exists and isn't the same file as the system or user
  58.   gvimrc file.  If this file is not owned by you, some security restrictions
  59.   apply.
  60.  
  61. NOTE: All but the first one are not carried out if Vim was started with
  62. "-u NONE" and no "-U" argument was given, or when started with "-U NONE".
  63.  
  64. All this happens AFTER the normal Vim initializations, like reading your
  65. .vimrc file.  See |initialization|.
  66.  
  67. You can use the gvimrc files to set up your own customised menus (see |:menu|)
  68. and initialise other things that you may want to set up differently from the
  69. terminal version.
  70.  
  71. There are a number of options which only have meaning in the GUI version of
  72. Vim.  These are 'guicursor', 'guifont', 'guipty' and 'guioptions'.  They are
  73. documented in |options.txt| with all the other options.
  74.  
  75. If using the Motif or Athena version of the GUI (not for the Win32 version), a
  76. number of X resources are available.  See |gui-resources|.
  77.  
  78. Another way to set the colors for different occasions is with highlight
  79. groups.  The "Normal" group is used to set the background and foreground
  80. colors.  Example (which looks nice):
  81.  
  82. >    :highlight Normal guibg=grey90
  83.  
  84. The "guibg" and "guifg" settings ovverride the normal background and
  85. foreground settings.  The other settings for the Normal highlight group are
  86. not used.  Use the 'guifont' option to set the font.
  87.  
  88. Also check out the 'guicursor' option, to set the colors for the cursor in
  89. various modes.
  90.  
  91. ==============================================================================
  92. 2. Scrollbars                        *gui-scrollbars*
  93.  
  94. There are vertical scrollbars and a horizontal scrollbars.  You may
  95. configure which ones appear with the 'guioptions' option.
  96.  
  97. The interface looks like this (with ":set guioptions=mlrb"):
  98.  
  99.                +------------------------------+
  100.                | File  Edit         Help | <- Menu bar (m)
  101.                +-+--------------------------+-+
  102.                |^|                |^|
  103.                |#| Text area.            |#|
  104.                | |                | |
  105.                |v|__________________________|v|
  106.  Normal status line -> |-+ File.c           5,2  +-|
  107.  between Vim windows   |^|""""""""""""""""""""""""""|^|
  108.                | |                | |
  109.                | | Another file buffer.     | |
  110.                | |                | |
  111.                |#|                |#|
  112.  Left scrollbar (l) -> |#|                |#| <- Right
  113.                |#|                |#|    scrollbar (r)
  114.                | |                | |
  115.                |v|                |v|
  116.                +-+--------------------------+-+
  117.                | |< ####           >| | <- Bottom
  118.                +-+--------------------------+-+    scrollbar (b)
  119.  
  120. Any of the scrollbar or menu components may be turned off by not putting the
  121. appropriate letter in the 'guioptions' string.  The bottom scrollbar is
  122. only useful when 'nowrap' is set.
  123.  
  124.  
  125. Vertical Scrollbars                    *gui-vert-scroll*
  126.  
  127. Each Vim window has a scrollbar next to it which may be scrolled up and down
  128. to move through the text in that buffer.  The size of the scrollbar-thumb
  129. indicates the fraction of the buffer which can be seen in the window.
  130. When the scrollbar is dragged all the way down, the last line of the file
  131. will appear in the top of the window.
  132.  
  133. If a window is shrunk to zero height (by the growth of another window) its
  134. scrollbar disappears. It reappears when the window is restored.
  135.  
  136. Horizontal Scrollbars                    *gui-horiz-scroll*
  137.  
  138. The horizontal scrollbar (at the bottom of the Vim GUI) may be used to
  139. scroll text sideways when the 'wrap' option is turned off.  The
  140. scrollbar-thumb size is such that the text of the current cursor line may be
  141. scrolled as far as possible left and right.
  142.  
  143.                             *athena-intellimouse*
  144. If you have an Intellimouse and are running Linux  and have the proper
  145. patches in your X server to use the wheel, then to can use the wheel to scroll
  146. the text up and down in gvim.  At the moment, it only works with the athena
  147. version.
  148.  
  149. In order to use this you must have a patched X server.  The following page has
  150. a bit of information about using the Intellimouse on Linux as well as links to
  151. the patches and X server binaries (may not have the one you need though):
  152.     http://www.inria.fr/koala/colas/mouse-wheel-scroll/
  153.  
  154. To use the wheel, put the cursor in the scrollbar area and move the wheel up
  155. or down.  This will scroll the text one line up or down.  If you hold down the
  156. shift key, it will scroll a page at a time.
  157.  
  158. ==============================================================================
  159. 3. Mouse Control                    *gui-mouse*
  160.  
  161. The mouse only works if the appropriate flag in the 'mouse' option is set.
  162. When the GUI is switched on, and 'mouse' wasn't set yet, the 'mouse' option is
  163. automatically set to "a", enabling it for all modes except for the
  164. |hit-return| prompt.  If you don't want this, a good place to change the
  165. 'mouse' option is the "gvimrc" file.
  166.  
  167. Other options that are relevant:
  168. 'mousefocus'    window focus follows mouse pointer |gui-mouse-focus|
  169. 'mousemodel'    what mouse button does which action
  170. 'mousehide'    hide mouse pointer while typing text
  171. 'selectmode'    whether to start Select mode or Visual mode
  172.  
  173. A quick way to set these is with the ":behave" command.
  174.                             *:behave* *:be*
  175. :be[have] {model}    Set behaviour for mouse and selection.  Valid
  176.             arguments are:
  177.                mswin    MS-Windows behaviour
  178.                xterm    Xterm behaviour
  179.  
  180.             Using ":behave" changes these options:
  181.             option        mswin            xterm    ~
  182.             'selectmode'    "mouse,key"        ""
  183.             'mousemodel'    "popup"            "extend"
  184.             'keymodel'    "startsel,stopsel"    ""
  185.             'selection'    "exclusive"        "inclusive"
  186.  
  187. In the $VIM directory, there is a script called "mswin.vim", which will also
  188. map a few keys to the MS-Windows cut/copy/paste commands.  This is NOT
  189. compatible, since it uses the CTRL-V, CTRL-X and CTRL-C keys.  If you don't
  190. mind, use this command:
  191. >    :so $VIM/mswin.vim
  192.  
  193.  
  194. 3.1 Moving Cursor with Mouse                *gui-mouse-move*
  195.  
  196. Click the left mouse button somewhere in a text buffer where you want the
  197. cursor to go, and it does!
  198. This works in        when 'mouse contains ~
  199. Normal mode        'n' or 'a'
  200. Visual mode        'v' or 'a'
  201. Insert mode        'i' or 'a'
  202.  
  203. Select mode is handled like Visual mode.
  204.  
  205. You may use this with an operator such as 'd' to delete text from the current
  206. cursor position to the position you point to with the mouse.  That is, you hit
  207. 'd' and then click the mouse somewhere.
  208.  
  209.                             *gui-mouse-focus*
  210. The 'mousefocus' option can be set to make the keyboard focus follow the
  211. mouse pointer.  This means that the window where the mouse pointer is, is the
  212. active window.  Warning: this doesn't work very well when using a menu,
  213. because the menu command will always be applied to the top window.
  214.  
  215. If you are on the ':' line (or '/' or '?'), then clicking the left or right
  216. mouse button will position the cursor on the ':' line (if 'mouse' contains
  217. 'c', 'a' or 'A').
  218.  
  219. In any situation the middle mouse button may be clicked to paste the current
  220. selection.
  221.  
  222.  
  223. 3.2 Selection with Mouse                *gui-mouse-select*
  224.  
  225. The mouse can be used to start a selection.  How depends on the 'mousemodel'
  226. option:
  227. 'mousemodel' is "extend": use the right mouse button
  228. 'mousemodel' is "popup":  use the left mouse button, while keeping the Shift
  229. key pressed.
  230.  
  231. If there was no selection yet, this starts a selection from the old cursor
  232. position to the position pointed to with the mouse.  If there already is a
  233. selection then the closest end will be extended.
  234.  
  235. If 'selectmode' contains "mouse", then the selection will be in Select mode.
  236. This means that typing normal text will replace the selection.  See
  237. |Select-mode|.  Otherwise, the selection will be in Visual mode.
  238.  
  239. Double clicking may be done to make the selection word-wise, triple clicking
  240. makes it line-wise, and quadruple clicking makes it rectangular block-wise.
  241.  
  242. See |gui-selections| on how the selection is used.
  243.  
  244.  
  245. 3.3 Other Text Selection with Mouse        *gui-mouse-modeless*
  246.  
  247. When in Command-line mode, at the |hit-return| prompt or whenever the current
  248. mode is not in the 'mouse' option, a different kind of selection is used.
  249. Since Vim continues like the selection isn't there, and there is no mode
  250. associated with the selection, this is called modeless selection.  Any text in
  251. the Vim window can be selected.  Select the text by pressing the left mouse
  252. button at the start, drag to the end and release.  To extend the selection,
  253. use the right mouse button when 'mousemodel' is "extend", or the left mouse
  254. button with the shift key pressed when 'mousemodel' is "popup".
  255. The middle mouse button pasts the text.
  256.  
  257.  
  258. 3.4 Using Mouse on Status Lines                *gui-mouse-status*
  259.  
  260. Clicking the left or right mouse button on the status line below a Vim
  261. window makes that window the current window.  The mouse may then be dragged
  262. up and down to move the status line, thus resizing the windows above and
  263. below it.
  264.  
  265.  
  266. 3.5 Various Mouse Clicks                *gui-mouse-various*
  267.  
  268.     <S-LeftMouse>    Search forward for the word under the mouse click.
  269.             When 'mousemodel' is "popup" this starts or extends a
  270.             selection.
  271.     <S-RightMouse>    Search backward for the word under the mouse click.
  272.     <C-LeftMouse>    Jump to the tag name under the mouse click.
  273.     <C-RightMouse>    Jump back to position before the previous tag jump
  274.             (same as "CTRL-T")
  275.  
  276.  
  277. 3.6 Mouse Mappings                    *gui-mouse-mapping*
  278.  
  279. The mouse events, complete with modifiers, may be mapped.  Eg:
  280. >   :map <S-LeftMouse>     <RightMouse>
  281. >   :map <S-LeftDrag>      <RightDrag>
  282. >   :map <S-LeftRelease>   <RightRelease>
  283. >   :map <2-S-LeftMouse>   <2-RightMouse>
  284. >   :map <2-S-LeftDrag>    <2-RightDrag>
  285. >   :map <2-S-LeftRelease> <2-RightRelease>
  286. >   :map <3-S-LeftMouse>   <3-RightMouse>
  287. >   :map <3-S-LeftDrag>    <3-RightDrag>
  288. >   :map <3-S-LeftRelease> <3-RightRelease>
  289. >   :map <4-S-LeftMouse>   <4-RightMouse>
  290. >   :map <4-S-LeftDrag>    <4-RightDrag>
  291. >   :map <4-S-LeftRelease> <4-RightRelease>
  292. These mappings make selection work the way it probably should in a Motif
  293. application, with shift-left mouse allowing for extending the visual area
  294. rather than the right mouse button.
  295.  
  296. Mouse mapping with modifiers does not work for modeless selection.
  297.  
  298. ==============================================================================
  299. 4. Making GUI Selections                *gui-selections*
  300.  
  301.                             *quotestar*
  302. You may make selections with the mouse (see |gui-mouse-select|), or by using
  303. Vim's Visual mode (see |v|).  If 'a' is present in 'guioptions', then
  304. whenever a selection is started (Visual or Select mode), or when the selection
  305. is changed, Vim becomes the owner of the windowing system's primary selection
  306. (on MS-Windows the |gui-clipboard| is used).
  307.  
  308. There is a special register for storing this selection, it is the <"*>
  309. register.  Nothing is put in here unless the information about what text is
  310. selected is about to change (eg with a left mouse click somewhere), or when
  311. another application wants to paste the selected text.  Then the text is put
  312. in the <"*> register.  For example, to cut a line and make it the current
  313. selection/put it on the clipboard:
  314. >    "*dd
  315.  
  316. Similarly, when you want to paste a selection from another application, e.g.,
  317. by clicking the middle mouse button, the selection is put in the <"*> register
  318. first, and then 'put' like any other register.  For example, to put the
  319. selection (contents of the clipboard):
  320. >    "*p
  321.  
  322. Note that when pasting text from one Vim into another separate Vim, the type
  323. of selection (character, line, or block) will also be copied.
  324.  
  325. ==============================================================================
  326. 5. Menus                        *gui-menus*
  327.  
  328. 5.1 Using Menus                        *gui-using-menus*
  329.  
  330. The default menus are quite simple at the moment.  Long-time Vim users won't
  331. use them much.  But the power is in adding your own menus and menu items.
  332. They are most useful for things that you can't remember what the key sequence
  333. was.
  334.  
  335. Motif supports Tear-off menus.  These are sort of sticky menus or pop-up menus
  336. that are present all the time.  If the resizing does not work correctly, this
  337. may be caused by using something like "Vim*geometry" in de defaults.  Use
  338. "Vim.geometry" instead.
  339.  
  340. The Win32 GUI version emulates Motif's tear-off menus.  Actually, a Motif user
  341. will spot the differences easily, but hopefully they're just as useful.  You
  342. can also use the |:tearoff| command together with |win32-hidden-menus| to
  343. create floating menus that do not appear on the main menu bar.
  344.  
  345.                             *menu.vim*
  346. The default menus are read from the file "$VIM/menu.vim".  See |$VIM| for
  347. where the path comes from.  You can set up your own menus.  Starting off with
  348. the default set is a good idea.  You can add more items, or, if you don't like
  349. the defaults at all, start with removing all menus |:unmenu-all|.
  350.  
  351.  
  352. 5.2 Creating New Menus                    *gui-creating-menus*
  353.  
  354.                 *:me*  *:menu*  *:noreme*  *:noremenu*
  355.                 *:am*  *:amenu* *:an*      *:anoremenu*
  356.                 *:nme* *:nmenu* *:nnoreme* *:nnoremenu*
  357.                 *:ome* *:omenu* *:onoreme* *:onoremenu*
  358.                 *:vme* *:vmenu* *:vnoreme* *:vnoremenu*
  359.                 *:ime* *:imenu* *:inoreme* *:inoremenu*
  360.                 *:cme* *:cmenu* *:cnoreme* *:cnoremenu*
  361. To create a new menu item, use the ":menu" commands.  They are exactly like
  362. the ":map" set of commands but the first argument is a menu item name, given
  363. as a path of menus and submenus with a '.' between them. eg:
  364. >   :menu File.Save  :w^M
  365. >   :inoremenu File.Save  ^O:w^M
  366. >   :menu Edit.Big\ Changes.Delete\ All\ Spaces  :%s/[ ^I]//g^M
  367.  
  368. This last one will create a new item in the menu bar called "Edit", holding
  369. the mouse button down on this will pop up a menu containing the item
  370. "Big Changes", which is a sub-menu containing the item "Delete All Spaces",
  371. which when selected, performs the operation.
  372.  
  373. Special characters in a menu name:
  374.     &    The next character is the shortcut key.  Make sure each
  375.         shortcut key is only used once in a (sub)menu.
  376.     <Tab>    Separates the menu name from right-aligned text.  This can be
  377.         used to show the equivalent typed command.  The text "<Tab>"
  378.         can be used here for convenience.  If you are using a real
  379.         Tab, don't forget to put a backslash before it!
  380. Example:
  381. >   :amenu &File.&Open<Tab>:e  :browse e<CR>
  382. [typed literally]
  383. With the shortcut "F" (while keeping the <Alt> key pressed), and then "O",
  384. this menu can be used.  The second part is shown as "Open     :e".  The ":e"
  385. is right aligned, and the "O" is underlined, to indicate it is the shortcut.
  386.  
  387. The ":amenu" command can be used to define menu entries for all modes at once.
  388. To make the command work correctly, a character is automatically inserted for
  389. some modes:
  390.     mode        inserted    ~
  391.     Normal        nothing
  392.     Visual        <Esc>
  393.     Insert        <C-O>
  394.     Cmdline        <C-C>
  395.     Op-pending    <Esc>
  396.  
  397. Example:
  398. >   :amenu File.Exit    :qa!^M
  399. is equal to:
  400. >   :nmenu File.Exit    :qa!^M
  401. >   :vmenu File.Exit    ^[:qa!^M
  402. >   :imenu File.Exit    ^O:qa!^M
  403. >   :cmenu File.Exit    ^C:qa!^M
  404. >   :omenu File.Exit    ^[:qa!^M
  405.  
  406. Careful: In Insert mode this only works for a SINGLE Normal mode command,
  407. because of the CTRL-O.  If you have two or more commands, you will need to use
  408. the ":imenu" command.  For inserting text in any mode, you can use the
  409. expression register:
  410. >   :amenu Insert.foobar   "='foobar'<CR>P
  411.  
  412. Note that the '<' and 'k' flags in 'cpoptions' also apply here (when
  413. included they make the <> form and raw key codes not being recognized).
  414.  
  415. Note that <Esc> in Cmdline mode executes the command, like in a mapping.  This
  416. is Vi compatible.  Use CTRL-C to quit Cmdline mode.
  417.  
  418.                             *menu-priority*
  419. You can give a priority to a menu.  Menus with a higher priority go more to
  420. the right.  The priority is given as a number before the ":menu" command.
  421. Example:
  422. >    :70menu Buffer.next :bn<CR>
  423.  
  424. The default menus have these priorities:
  425.     File    10
  426.     Edit    20
  427.     Syntax    50
  428.     Help    9999
  429.  
  430. When no priority is given, 500 is used.
  431.  
  432. You can use a priority higher than 9999, to make it go after the Help menu,
  433. but that is non-standard and is discouraged.  The highest possible priority is
  434. about 32000.
  435.  
  436.                             *sub-menu-priority*
  437. The same mechanism can be used to position a sub-menu.  The priority is then
  438. given as a dot-separated list of priorities, before the menu name:
  439. >    :menu 70.500 Buffer.next :bn<CR>
  440. Giving the sub-menu priority is only needed when the item is not to be put
  441. in a normal position.  For example, to put a sub-menu before the other items:
  442. >    :menu 70.100 Buffer.first :brew<CR>
  443. Or to put a sub-menu after the other items, and furter items with default
  444. priority will be put before it:
  445. >    :menu 70.900 Buffer.last :blast<CR>
  446. When a number is missing, the default value 500 will be used:
  447. >    :menu .900 myMenu.test :echo "text"<CR>
  448. The menu priority is only used when creating a new menu.  When it already
  449. existed, the priority will not change.  Thus, the priority only needs to be
  450. given the first time a menu is used.
  451. NOTE: sub-menu priorities currently don't work for all versions of the GUI.
  452.  
  453.                             *gui-toolbar*
  454. Currently, the toolbar is only available in the Win32 GUI. It should turn up
  455. in other GUIs in due course. Sample toolbar definitions are given in menu.vim.
  456. The display of the toolbar is controlled by the 'guioptions' letter 'T'. You
  457. can thus have menu & toolbar together, or either on its own, or neither.
  458.  
  459. The toolbar is defined as a special menu called ToolBar, which only has one
  460. level. Vim interprets the items in this menu as follows:
  461. 1)  An item called 'BuiltIn##', where ## is a number, is taken as number ## of
  462.     the built-in bitmaps available in Vim. Currently there are 28, numbered
  463.     from 0 to 27, which cover most common editing operations |builtin-tools|.
  464. 2)  An item with another name is first searched for in the directory
  465.     $VIM/bitmaps. If found, the bitmaps file is used as the toolbar button
  466.     image. Note that the exact filename is OS-specific: For example, under
  467.     Win32 the command
  468. >    :amenu ToolBar.Hello :echo "hello"<CR>
  469.     would search for the file 'hello.bmp'. Under X11 it might be 'Hello.xpm'.
  470.     Loading a custom bitmap is only supported on W95 and NT4. The bitmap is
  471.     scaled to fit the button.
  472. 3)  If the bitmap is not found in $VIM/bitmaps, Vim checks for a match against
  473.     its list of built-in names. Each built-in button image has a name. So the
  474.     command
  475. >    :amenu ToolBar.Open :e
  476.     will show the built in "open a file" button image if no open.bmp exists.
  477.     All the built-in names can be seen used in menu.vim.
  478. 4)  If all else fails, a blank, but functioning, button is displayed.
  479.  
  480.                             *builtin-tools*
  481. nr  Name        Normal action  ~
  482. 00  New            open new window
  483. 01  Open        browse for file to open in current window
  484. 02  Save        write buffer to file
  485. 03  Undo        undo last change
  486. 04  Redo        redo last undone change
  487. 05  Cut            delete selected text to clipboard
  488. 06  Copy        copy selected text to clipboard
  489. 07  Paste        paste text from clipboard
  490. 08  Print        print current buffer
  491. 09  Help        open a buffer on Vim's builtin help
  492. 10  Find        start a search command
  493. 11  SaveAll        write all modified buffers to file
  494. 12  SaveSession        write session file for current situation
  495. 13  NewSession        write new session file
  496. 14  LoadSession        load session file
  497. 15  RunMacro        browse for file to run
  498. 16  Replace        prompt for substitute command
  499. 17  WinClose        close current window
  500. 18  WinZoom        make current window use many lines
  501. 19  WinMin        make current window use few lines
  502. 20  WinSplit        split current window
  503. 21  Shell        start a shell
  504. 22  FindPrev        search again, backward
  505. 23  FindNext        search again, forward
  506. 24  FindHelp        prompt for word to search help for
  507. 25  Make        run make and jump to first error
  508. 26  TagsJump        jump to tag under the cursor
  509. 27  TagsBuild        build tags for files in current directory
  510.  
  511.                             *win32-hidden-menus*
  512. In the Win32 GUI, starting a menu name with ']' excludes that menu from the
  513. main menu bar.  You must then use the |:tearoff| command to display it.
  514.  
  515.                             *win32-popup-menu*
  516. Also in the Win32 GUI, you can define the special menu "PopUp".  This is the
  517. menu that is displayed when the right mouse button is pressed, if 'M' is
  518. present in the 'mouse' option.
  519.  
  520.  
  521. 5.3 Showing What Menus Are Mapped To            *gui-showing-menus*
  522.  
  523. To see what an existing menu is mapped to, use just one argument after the
  524. menu commands (just like you would with the ":map" commands).  If the menu
  525. specified is a submenu, then all menus under that hierarchy will be shown.
  526. If no argument is given after :menu at all, then ALL menu items are shown
  527. for the appropriate mode (eg, Command-line mode for :cmenu).
  528.  
  529. Note that hitting <Tab> while entering a menu name after a menu command may
  530. be used to complete the name of the menu item.
  531.  
  532.  
  533. 5.4 Deleting Menus                    *gui-delete-menus*
  534.  
  535.                         *:unme*  *:unmenu*
  536.                         *:aun*   *:aunmenu*
  537.                         *:nunme* *:nunmenu*
  538.                         *:ounme* *:ounmenu*
  539.                         *:vunme* *:vunmenu*
  540.                         *:iunme* *:iunmenu*
  541.                         *:cunme* *:cunmenu*
  542. To delete a menu item or a whole submenu, use the unmenu commands, which are
  543. analogous to the unmap commands.  Eg:
  544.     :unmenu! Edit.Paste
  545.  
  546. This will remove the Paste item from the Edit menu for Insert and
  547. Command-line modes.
  548.  
  549. Note that hitting <Tab> while entering a menu name after an umenu command
  550. may be used to complete the name of the menu item for the appropriate mode.
  551.  
  552. To remove all menus use:            *:unmenu-all*
  553. >    :unmenu *    " remove all menus in Normal and visual mode
  554. >    :unmenu! *    " remove all menus in Insert and Command-line mode
  555.  
  556.  
  557. 5.5 Examples for Menus
  558.  
  559. Here is an example on how to add menu items with menu's!  You can add a menu
  560. item for the keyword under the cursor.  The register "z" is used.
  561.  
  562. >  :nmenu Words.Add\ Var    wb"zye:menu! Words.<C-R>z <C-R>z<CR>
  563. >  :nmenu Words.Remove\ Var    wb"zye:unmenu! Words.<C-R>z<CR>
  564. >  :vmenu Words.Add\ Var    "zy:menu! Words.<C-R>z <C-R>z <CR>
  565. >  :vmenu Words.Remove\ Var    "zy:unmenu! Words.<C-R>z<CR>
  566. >  :imenu Words.Add\ Var    <Esc>wb"zye:menu! Words.<C-R>z <C-R>z<CR>a
  567. >  :imenu Words.Remove\ Var    <Esc>wb"zye:unmenu! Words.<C-R>z<CR>a
  568.  
  569. (the rhs is in <> notation, you can copy/paste this text to try out the
  570. mappings, or put these lines in your gvimrc; "<C-R>" is CTRL-R, "<CR>" is
  571. the <CR> key.  |<>|)
  572.  
  573. Tooltips & Menu tips
  574.  
  575. These are currently only supported for the Win32 GUI. However, they should
  576. appear for the other gui platforms in the not too distant future.
  577.  
  578.                             *:tmenu* *:tm*
  579. :tm[enu] {menupath} {rhs}    Define a tip for a menu or tool.  {only in
  580.                 Win32 GUI}
  581.  
  582. :tm[enu] [menupath]        List menu tips. {only in Win32 GUI}
  583.  
  584. A "tip" can be defined for each menu item. For example, after defining an item
  585. like this:
  586. >    :amenu MyMenu.Hello :echo "Hello"<CR>
  587. The tip is defined like this:
  588. >    :tmenu MyMenu.Hello Displays a greeting.
  589.  
  590. When a tip is defined for a menu item, it appears in the command-line area
  591. when the mouse is over that item, much like a standard Windows menu hint in
  592. the status bar. (Except when Vim is in command-line mode, when of course
  593. nothing is displayed.)
  594. When a tip is defined for a toolbar item, it appears as a tooltip when the
  595. mouse pauses over that button, in the usual fashion.
  596.  
  597. The ":tmenu" command works just like other menu commands, it uses the same
  598. arguments.
  599.  
  600.                             *:tunmenu* *:tu*
  601. :tu[nmenu] {menupath}        Remove a tip for a menu or tool.  {only in
  602.                 Win32 GUI}
  603.  
  604. :tunmenu deletes an existing menu tip, in the same way as the other unmenu
  605. commands.  Example:
  606. >    :tunmenu MyMenu.Hello
  607. If a menu item becomes invalid (i.e. its actions in all modes are deleted) Vim
  608. deletes the menu tip (and the item) for you.  This means that :aunmenu deletes
  609. a menu item - you don't need to do a :tunmenu as well.
  610.  
  611. ==============================================================================
  612. 6. Extras                        *gui-extras*
  613.  
  614. This section describes other features which are related to the GUI.
  615.  
  616. - With the GUI, there is no wait for one second after hitting escape, because
  617.   the key codes don't start with <Esc>.
  618.  
  619. - Typing ^V followed by a special key in the GUI will insert "<Key>", since
  620.   the internal string used is meaningless.  Modifiers may also be held down to
  621.   get "<Modifiers-Key>".
  622.  
  623. - In the GUI, the modifiers SHIFT, CTRL, and ALT (or META) may be used within
  624.   mappings of special keys and mouse events.  eg: :map <M-LeftDrag> <LeftDrag>
  625.  
  626. - In the GUI, several normal keys may have modifiers in mappings etc, these
  627.   are <Space>, <Tab>, <NL>, <CR>, <Esc>.
  628.  
  629. ==============================================================================
  630. 7. Shell Commands                    *gui-shell*
  631.  
  632. WARNING: Executing an external command from the GUI will not always work.
  633. "normal" commands like "ls", "grep" and "make" mostly work fine.  Commands
  634. that require an intelligent terminal like "less" and "ispell" won't work.
  635. Some may even hang and need to be killed from another terminal.  So be
  636. careful!
  637.  
  638. For the X11 GUI the external commands are executed inside the gvim window.
  639. See |gui-pty|.
  640.  
  641. For the Win32 GUI the external commands are executed in a separate window.
  642. See |gui-shell-win32|.
  643.  
  644.  vim:tw=78:ts=8:sw=4
  645.