代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>gui - Vim Documentation</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim8.0">
<meta name="syntax" content="help">
<meta name="settings" content="no_pre,use_css,expand_tabs">
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="jquery.min.js" type="text/javascript"></script>
<script src="mark-current-page.js" type="text/javascript"></script>
</head>
<body>
<header>
<div class="header">
<a href="http://vim-jp.org/">vim-jp</a>
/ <a href="http://vim-jp.org/vimdoc-en/">vimdoc-en</a>
/ gui<br />
<a name="top"></a><h1>gui - Vim Documentation</h1>
<a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
</div>
</header>
<nav>
<dl>
<dt>BASIC</dt>
<dd><ul>
<li><a href="quickref.html">quickref</a></li>
<li><a href="sponsor.html">sponsor</a></li>
</ul></dd>
<dt>USER MANUAL</dt>
<dd><ul>
<li><a href="usr_toc.html">usr_toc</a></li>
</ul></dd>
<dt>Getting Started</dt>
<dd><ul>
<li><a href="usr_01.html">usr_01</a></li>
<li><a href="usr_02.html">usr_02</a></li>
<li><a href="usr_03.html">usr_03</a></li>
<li><a href="usr_04.html">usr_04</a></li>
<li><a href="usr_05.html">usr_05</a></li>
<li><a href="usr_06.html">usr_06</a></li>
<li><a href="usr_07.html">usr_07</a></li>
<li><a href="usr_08.html">usr_08</a></li>
<li><a href="usr_09.html">usr_09</a></li>
<li><a href="usr_10.html">usr_10</a></li>
<li><a href="usr_11.html">usr_11</a></li>
<li><a href="usr_12.html">usr_12</a></li>
</ul></dd>
<dt>Editing Effectively</dt>
<dd><ul>
<li><a href="usr_20.html">usr_20</a></li>
<li><a href="usr_21.html">usr_21</a></li>
<li><a href="usr_22.html">usr_22</a></li>
<li><a href="usr_23.html">usr_23</a></li>
<li><a href="usr_24.html">usr_24</a></li>
<li><a href="usr_25.html">usr_25</a></li>
<li><a href="usr_26.html">usr_26</a></li>
<li><a href="usr_27.html">usr_27</a></li>
<li><a href="usr_28.html">usr_28</a></li>
<li><a href="usr_29.html">usr_29</a></li>
<li><a href="usr_30.html">usr_30</a></li>
<li><a href="usr_31.html">usr_31</a></li>
<li><a href="usr_32.html">usr_32</a></li>
</ul></dd>
<dt>Tuning Vim</dt>
<dd><ul>
<li><a href="usr_40.html">usr_40</a></li>
<li><a href="usr_41.html">usr_41</a></li>
<li><a href="usr_42.html">usr_42</a></li>
<li><a href="usr_43.html">usr_43</a></li>
<li><a href="usr_44.html">usr_44</a></li>
<li><a href="usr_45.html">usr_45</a></li>
</ul></dd>
<dt>Making Vim Run</dt>
<dd><ul>
<li><a href="usr_90.html">usr_90</a></li>
</ul></dd>
<dt>General subjects</dt>
<dd><ul>
<li><a href="intro.html">intro</a></li>
<li><a href="index.html">help</a></li>
<li><a href="helphelp.html">helphelp</a></li>
<li><a href="vimindex.html">index</a></li>
<li><a href="tags.html">tags</a></li>
<li><a href="howto.html">howto</a></li>
<li><a href="tips.html">tips</a></li>
<li><a href="message.html">message</a></li>
<li><a href="quotes.html">quotes</a></li>
<li><a href="todo.html">todo</a></li>
<li><a href="debug.html">debug</a></li>
<li><a href="develop.html">develop</a></li>
<li><a href="uganda.html">uganda</a></li>
</ul></dd>
<dt>Basic editing</dt>
<dd><ul>
<li><a href="starting.html">starting</a></li>
<li><a href="editing.html">editing</a></li>
<li><a href="motion.html">motion</a></li>
<li><a href="scroll.html">scroll</a></li>
<li><a href="insert.html">insert</a></li>
<li><a href="change.html">change</a></li>
<li><a href="indent.html">indent</a></li>
<li><a href="undo.html">undo</a></li>
<li><a href="repeat.html">repeat</a></li>
<li><a href="visual.html">visual</a></li>
<li><a href="various.html">various</a></li>
<li><a href="recover.html">recover</a></li>
</ul></dd>
<dt>Advanced editing</dt>
<dd><ul>
<li><a href="cmdline.html">cmdline</a></li>
<li><a href="options.html">options</a></li>
<li><a href="pattern.html">pattern</a></li>
<li><a href="map.html">map</a></li>
<li><a href="tagsrch.html">tagsrch</a></li>
<li><a href="quickfix.html">quickfix</a></li>
<li><a href="windows.html">windows</a></li>
<li><a href="tabpage.html">tabpage</a></li>
<li><a href="syntax.html">syntax</a></li>
<li><a href="spell.html">spell</a></li>
<li><a href="diff.html">diff</a></li>
<li><a href="autocmd.html">autocmd</a></li>
<li><a href="filetype.html">filetype</a></li>
<li><a href="eval.html">eval</a></li>
<li><a href="channel.html">channel</a></li>
<li><a href="fold.html">fold</a></li>
</ul></dd>
<dt>Special issues</dt>
<dd><ul>
<li><a href="print.html">print</a></li>
<li><a href="remote.html">remote</a></li>
<li><a href="term.html">term</a></li>
<li><a href="digraph.html">digraph</a></li>
<li><a href="mbyte.html">mbyte</a></li>
<li><a href="mlang.html">mlang</a></li>
<li><a href="arabic.html">arabic</a></li>
<li><a href="farsi.html">farsi</a></li>
<li><a href="hebrew.html">hebrew</a></li>
<li><a href="russian.html">russian</a></li>
<li><a href="ft_ada.html">ft_ada</a></li>
<li><a href="ft_sql.html">ft_sql</a></li>
<li><a href="hangulin.html">hangulin</a></li>
<li><a href="rileft.html">rileft</a></li>
</ul></dd>
<dt>GUI</dt>
<dd><ul>
<li><a href="gui.html">gui</a></li>
<li><a href="gui_w32.html">gui_w32</a></li>
<li><a href="gui_x11.html">gui_x11</a></li>
</ul></dd>
<dt>Interfaces</dt>
<dd><ul>
<li><a href="if_cscop.html">if_cscop</a></li>
<li><a href="if_lua.html">if_lua</a></li>
<li><a href="if_mzsch.html">if_mzsch</a></li>
<li><a href="if_perl.html">if_perl</a></li>
<li><a href="if_pyth.html">if_pyth</a></li>
<li><a href="if_tcl.html">if_tcl</a></li>
<li><a href="if_ole.html">if_ole</a></li>
<li><a href="if_ruby.html">if_ruby</a></li>
<li><a href="debugger.html">debugger</a></li>
<li><a href="workshop.html">workshop</a></li>
<li><a href="netbeans.html">netbeans</a></li>
<li><a href="sign.html">sign</a></li>
</ul></dd>
<dt>Versions</dt>
<dd><ul>
<li><a href="vi_diff.html">vi_diff</a></li>
<li><a href="version4.html">version4</a></li>
<li><a href="version5.html">version5</a></li>
<li><a href="version6.html">version6</a></li>
<li><a href="version7.html">version7</a></li>
<li><a href="version8.html">version8</a></li>
</ul></dd>
<dt>Remarks about specific systems</dt>
<dd><ul>
<li><a href="os_390.html">os_390</a></li>
<li><a href="os_amiga.html">os_amiga</a></li>
<li><a href="os_beos.html">os_beos</a></li>
<li><a href="os_dos.html">os_dos</a></li>
<li><a href="os_mac.html">os_mac</a></li>
<li><a href="os_mint.html">os_mint</a></li>
<li><a href="os_msdos.html">os_msdos</a></li>
<li><a href="os_os2.html">os_os2</a></li>
<li><a href="os_qnx.html">os_qnx</a></li>
<li><a href="os_risc.html">os_risc</a></li>
<li><a href="os_unix.html">os_unix</a></li>
<li><a href="os_vms.html">os_vms</a></li>
<li><a href="os_win32.html">os_win32</a></li>
</ul></dd>
<dt>Standard plugins</dt>
<dd><ul>
<li><a href="pi_getscript.html">pi_getscript</a></li>
<li><a href="pi_gzip.html">pi_gzip</a></li>
<li><a href="pi_logipat.html">pi_logipat</a></li>
<li><a href="pi_netrw.html">pi_netrw</a></li>
<li><a href="pi_paren.html">pi_paren</a></li>
<li><a href="pi_tar.html">pi_tar</a></li>
<li><a href="pi_vimball.html">pi_vimball</a></li>
<li><a href="pi_zip.html">pi_zip</a></li>
</ul></dd>
<dt>Filetype plugins</dt>
<dd><ul>
<li><a href="pi_spec.html">pi_spec</a></li>
</ul></dd>
<dt>Others</dt>
<dd><ul>
<li><a href="vim_faq.html">vim_faq</a></li>
</ul></dd>
</dl>
</nav>
<article class="Vimdoc VimdocJa">
<div id='vimCodeElement'>
<a class="Constant" href="gui.html" name="gui.txt">gui.txt</a> For <span class="Identifier">Vim version 8.0.</span> Last change: 2017 Jul 15<br>
<br>
<br>
<span class="Identifier">VIM REFERENCE MANUAL by Bram Moolenaar</span><br>
<br>
<br>
Vim's Graphical User Interface <a class="Constant" href="gui.html#gui" name="gui">gui</a> <a class="Constant" href="gui.html#GUI" name="GUI">GUI</a><br>
<br>
1. Starting the GUI <a class="Identifier" href="gui.html#gui-start">gui-start</a><br>
2. Scrollbars <a class="Identifier" href="gui.html#gui-scrollbars">gui-scrollbars</a><br>
3. Mouse Control <a class="Identifier" href="gui.html#gui-mouse">gui-mouse</a><br>
4. Making GUI Selections <a class="Identifier" href="gui.html#gui-selections">gui-selections</a><br>
5. Menus <a class="Identifier" href="gui.html#menus">menus</a><br>
6. Extras <a class="Identifier" href="gui.html#gui-extras">gui-extras</a><br>
7. Shell Commands <a class="Identifier" href="gui.html#gui-shell">gui-shell</a><br>
<br>
Other GUI documentation:<br>
<a class="Identifier" href="gui_x11.html">gui_x11.txt</a> For specific items of the X11 GUI.<br>
<a class="Identifier" href="gui_w32.html">gui_w32.txt</a> For specific items of the Win32 GUI.<br>
<br>
<span class="Special">{Vi does not have any of these commands}</span><br>
<br>
<span class="PreProc">==============================================================================</span><br>
1. Starting the GUI <a class="Constant" href="gui.html#gui-start" name="gui-start">gui-start</a> <a class="Constant" href="gui.html#E229" name="E229">E229</a> <a class="Constant" href="gui.html#E233" name="E233">E233</a><br>
<br>
First you must make sure you actually have a version of Vim with the GUI code<br>
included. You can check this with the ":version" command, it says "with xxx<br>
GUI", where "xxx" is X11-Motif, X11-Athena, Photon, GTK2, GTK3, etc., or<br>
"MS-Windows 32 bit GUI version".<br>
<br>
How to start the GUI depends on the system used. Mostly you can run the<br>
GUI version of Vim with:<br>
gvim <span class="Special">[options]</span> [files...]<br>
<br>
The X11 version of Vim can run both in GUI and in non-GUI mode. See<br>
<a class="Identifier" href="gui_x11.html#gui-x11-start">gui-x11-start</a>.<br>
<br>
<a class="Constant" href="gui.html#gui-init" name="gui-init">gui-init</a> <a class="Constant" href="gui.html#gvimrc" name="gvimrc">gvimrc</a> <a class="Constant" href="gui.html#.gvimrc" name=".gvimrc">.gvimrc</a> <a class="Constant" href="gui.html#_gvimrc" name="_gvimrc">_gvimrc</a> <a class="Constant" href="gui.html#$MYGVIMRC" name="$MYGVIMRC">$MYGVIMRC</a><br>
The gvimrc file is where GUI-specific startup commands should be placed. It<br>
is always sourced after the <a class="Identifier" href="starting.html#vimrc">vimrc</a> file. If you have one then the $MYGVIMRC<br>
environment variable has its name.<br>
<br>
When the GUI starts up initializations are carried out, in this order:<br>
- The <a class="Type" href="options.html#'term'">'term'</a> option is set to "builtin_gui" and terminal options are reset to<br>
their default value for the GUI <a class="Identifier" href="term.html#terminal-options">terminal-options</a>.<br>
- If the system menu file exists, it is sourced. The name of this file is<br>
normally "$VIMRUNTIME/menu.vim". You can check this with ":version". Also<br>
see <a class="Identifier" href="starting.html#$VIMRUNTIME">$VIMRUNTIME</a>. To skip loading the system menu include 'M' in<br>
<a class="Type" href="options.html#'guioptions'">'guioptions'</a>. <a class="Constant" href="gui.html#buffers-menu" name="buffers-menu">buffers-menu</a> <a class="Constant" href="gui.html#no_buffers_menu" name="no_buffers_menu">no_buffers_menu</a><br>
The system menu file includes a "Buffers" menu. If you don't want this, set<br>
the "no_buffers_menu" variable in your .vimrc (not .gvimrc!):<br>
<div class="helpExample"> :let no_buffers_menu = 1</div>
<span class="Todo">NOTE</span>: Switching on syntax highlighting also loads the menu file, thus<br>
disabling the Buffers menu must be done before ":syntax on".<br>
The path names are truncated to 35 characters. You can truncate them at a<br>
different length, for example 50, like this:<br>
<div class="helpExample"> :let bmenu_max_pathlen = 50</div>
- If the "-U <span class="Special">{gvimrc}</span>" command-line option has been used when starting Vim,<br>
the <span class="Special">{gvimrc}</span> file will be read for initializations. The following<br>
initializations are skipped. When <span class="Special">{gvimrc}</span> is "NONE" no file will be read<br>
for initializations.<br>
- For Unix and MS-Windows, if the system gvimrc exists, it is sourced. The<br>
name of this file is normally "$VIM/gvimrc". You can check this with<br>
":version". Also see <a class="Identifier" href="starting.html#$VIM">$VIM</a>.<br>
- The following are tried, and only the first one that exists is used:<br>
- If the GVIMINIT environment variable exists and is not empty, it is<br>
executed as an Ex command.<br>
- If the user gvimrc file exists, it is sourced. The name of this file is<br>
normally "$HOME/.gvimrc". You can check this with ":version".<br>
- For Win32, when $HOME is not set, "$VIM\_gvimrc" is used.<br>
- When a "_gvimrc" file is not found, ".gvimrc" is tried too. And vice<br>
versa.<br>
The name of the first file found is stored in $MYGVIMRC, unless it was<br>
already set.<br>
- If the <a class="Type" href="options.html#'exrc'">'exrc'</a> option is set (which is NOT the default) the file ./.gvimrc<br>
is sourced, if it exists and isn't the same file as the system or user<br>
gvimrc file. If this file is not owned by you, some security restrictions<br>
apply. When ".gvimrc" is not found, "_gvimrc" is tried too. For Macintosh<br>
and DOS/Win32 "_gvimrc" is tried first.<br>
<br>
<span class="Todo">NOTE</span>: All but the first one are not carried out if Vim was started with<br>
"-u NONE" or "-u DEFAULTS" and no "-U" argument was given, or when started<br>
with "-U NONE".<br>
<br>
All this happens AFTER the normal Vim initializations, like reading your<br>
.vimrc file. See <a class="Identifier" href="starting.html#initialization">initialization</a>.<br>
But the GUI window is only opened after all the initializations have been<br>
carried out. If you want some commands to be executed just after opening the<br>
GUI window, use the <a class="Identifier" href="autocmd.html#GUIEnter">GUIEnter</a> autocommand event. Example:<br>
<div class="helpExample"> :autocmd GUIEnter * winpos 100 50</div>
<br>
You can use the gvimrc files to set up your own customized menus (see <a class="Identifier" href="gui.html#:menu">:menu</a>)<br>
and initialize other things that you may want to set up differently from the<br>
terminal version.<br>
<br>
Recommended place for your personal GUI initializations:<br>
Unix $HOME/.gvimrc or $HOME/.vim/gvimrc<br>
OS/2 $HOME/.gvimrc, $HOME/vimfiles/gvimrc<br>
or $VIM/.gvimrc<br>
MS-DOS and Win32 $HOME/_gvimrc, $HOME/vimfiles/gvimrc<br>
or $VIM/_gvimrc<br>
Amiga s:.gvimrc, home:.gvimrc, home:vimfiles:gvimrc<br>
or $VIM/.gvimrc<br>
<br>
The personal initialization files are searched in the order specified above<br>
and only the first one that is found is read.<br>
<br>
There are a number of options which only have meaning in the GUI version of<br>
Vim. These are <a class="Type" href="options.html#'guicursor'">'guicursor'</a>, <a class="Type" href="options.html#'guifont'">'guifont'</a>, <a class="Type" href="options.html#'guipty'">'guipty'</a> and <a class="Type" href="options.html#'guioptions'">'guioptions'</a>. They are<br>
documented in <a class="Identifier" href="options.html">options.txt</a> with all the other options.<br>
<br>
If using the Motif or Athena version of the GUI (but not for the GTK+ or<br>
Win32 version), a number of X resources are available. See <a class="Identifier" href="gui_x11.html#gui-resources">gui-resources</a>.<br>
<br>
Another way to set the colors for different occasions is with highlight<br>
groups. The "Normal" group is used to set the background and foreground<br>
colors. Example (which looks nice):<br>
<br>
<div class="helpExample"> :highlight Normal guibg=grey90</div>
<br>
The "guibg" and "guifg" settings override the normal background and<br>
foreground settings. The other settings for the Normal highlight group are<br>
not used. Use the <a class="Type" href="options.html#'guifont'">'guifont'</a> option to set the font.<br>
<br>
Also check out the <a class="Type" href="options.html#'guicursor'">'guicursor'</a> option, to set the colors for the cursor in<br>
various modes.<br>
<br>
Vim tries to make the window fit on the screen when it starts up. This avoids<br>
that you can't see part of it. On the X Window System this requires a bit of<br>
guesswork. You can change the height that is used for the window title and a<br>
task bar with the <a class="Type" href="options.html#'guiheadroom'">'guiheadroom'</a> option.<br>
<br>
<a class="Constant" href="gui.html#:winp" name=":winp">:winp</a> <a class="Constant" href="gui.html#:winpos" name=":winpos">:winpos</a> <a class="Constant" href="gui.html#E188" name="E188">E188</a><br>
:winp[os]<br>
Display current position of the top left corner of the GUI vim<br>
window in pixels. Does not work in all versions.<br>
Also see <a class="Identifier" href="eval.html#getwinposx()">getwinposx()</a> and <a class="Identifier" href="eval.html#getwinposy()">getwinposy()</a>.<br>
<br>
:winp[os] <span class="Special">{X}</span> <span class="Special">{Y}</span> <a class="Constant" href="gui.html#E466" name="E466">E466</a><br>
Put the GUI vim window at the given <span class="Special">{X}</span> and <span class="Special">{Y}</span> coordinates.<br>
The coordinates should specify the position in pixels of the<br>
top left corner of the window. Does not work in all versions.<br>
Does work in an (new) xterm <a class="Identifier" href="syntax.html#xterm-color">xterm-color</a>.<br>
When the GUI window has not been opened yet, the values are<br>
remembered until the window is opened. The position is<br>
adjusted to make the window fit on the screen (if possible).<br>
<br>
<a class="Constant" href="gui.html#:win" name=":win">:win</a> <a class="Constant" href="gui.html#:winsize" name=":winsize">:winsize</a> <a class="Constant" href="gui.html#E465" name="E465">E465</a><br>
:win[size] <span class="Special">{width}</span> <span class="Special">{height}</span><br>
Set the window height to <span class="Special">{width}</span> by <span class="Special">{height}</span> characters.<br>
Obsolete, use ":set lines=11 columns=22".<br>
If you get less lines than expected, check the <a class="Type" href="options.html#'guiheadroom'">'guiheadroom'</a><br>
option.<br>
<br>
If you are running the X Window System, you can get information about the<br>
window Vim is running in with these commands:<br>
<div class="helpExample"> :!xwininfo -id $WINDOWID<br>
:!xprop -id $WINDOWID<br>
:execute '!xwininfo -id ' . v:windowid<br>
:execute '!xprop -id ' . v:windowid</div>
<br>
<a class="Constant" href="gui.html#gui-IME" name="gui-IME">gui-IME</a> <a class="Constant" href="gui.html#iBus" name="iBus">iBus</a><br>
Input methods for international characters in X that rely on the XIM<br>
framework, most notably iBus, have been known to produce undesirable results<br>
in gVim. These may include an inability to enter spaces, or long delays<br>
between typing a character and it being recognized by the application.<br>
<br>
One workaround that has been successful, for unknown reasons, is to prevent<br>
gvim from forking into the background by starting it with the <a class="Identifier" href="starting.html#-f">-f</a> argument.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
2. Scrollbars <a class="Constant" href="gui.html#gui-scrollbars" name="gui-scrollbars">gui-scrollbars</a><br>
<br>
There are vertical scrollbars and a horizontal scrollbar. You may<br>
configure which ones appear with the <a class="Type" href="options.html#'guioptions'">'guioptions'</a> option.<br>
<br>
The interface looks like this (with ":set guioptions=mlrb"):<br>
<br>
+------------------------------+ <br>
| File Edit Help | <- Menu bar (m) <br>
+-+--------------------------+-+ <br>
|^| |^| <br>
|#| Text area. |#| <br>
| | | | <br>
|v|__________________________|v| <br>
Normal status line -> |-+ File.c 5,2 +-| <br>
between Vim windows |^|""""""""""""""""""""""""""|^| <br>
| | | | <br>
| | Another file buffer. | | <br>
| | | | <br>
|#| |#| <br>
Left scrollbar (l) -> |#| |#| <- Right <br>
|#| |#| scrollbar (r) <br>
| | | | <br>
|v| |v| <br>
+-+--------------------------+-+ <br>
| |< #### >| | <- Bottom <br>
+-+--------------------------+-+ scrollbar (b) <br>
<br>
Any of the scrollbar or menu components may be turned off by not putting the<br>
appropriate letter in the <a class="Type" href="options.html#'guioptions'">'guioptions'</a> string. The bottom scrollbar is<br>
only useful when <a class="Type" href="options.html#'nowrap'">'nowrap'</a> is set.<br>
<br>
<br>
<span class="Statement">VERTICAL SCROLLBARS </span><a class="Constant" href="gui.html#gui-vert-scroll" name="gui-vert-scroll">gui-vert-scroll</a><br>
<br>
Each Vim window has a scrollbar next to it which may be scrolled up and down<br>
to move through the text in that buffer. The size of the scrollbar-thumb<br>
indicates the fraction of the buffer which can be seen in the window.<br>
When the scrollbar is dragged all the way down, the last line of the file<br>
will appear in the top of the window.<br>
<br>
If a window is shrunk to zero height (by the growth of another window) its<br>
scrollbar disappears. It reappears when the window is restored.<br>
<br>
If a window is vertically split, it will get a scrollbar when it is the<br>
current window and when, taking the middle of the current window and drawing a<br>
vertical line, this line goes through the window.<br>
When there are scrollbars on both sides, and the middle of the current window<br>
is on the left half, the right scrollbar column will contain scrollbars for<br>
the rightmost windows. The same happens on the other side.<br>
<br>
<br>
<span class="Statement">HORIZONTAL SCROLLBARS </span><a class="Constant" href="gui.html#gui-horiz-scroll" name="gui-horiz-scroll">gui-horiz-scroll</a><br>
<br>
The horizontal scrollbar (at the bottom of the Vim GUI) may be used to<br>
scroll text sideways when the <a class="Type" href="options.html#'wrap'">'wrap'</a> option is turned off. The<br>
scrollbar-thumb size is such that the text of the longest visible line may be<br>
scrolled as far as possible left and right. The cursor is moved when<br>
necessary, it must remain on a visible character (unless <a class="Type" href="options.html#'virtualedit'">'virtualedit'</a> is<br>
set).<br>
<br>
Computing the length of the longest visible line takes quite a bit of<br>
computation, and it has to be done every time something changes. If this<br>
takes too much time or you don't like the cursor jumping to another line,<br>
include the 'h' flag in <a class="Type" href="options.html#'guioptions'">'guioptions'</a>. Then the scrolling is limited by the<br>
text of the current cursor line.<br>
<br>
<a class="Constant" href="gui.html#athena-intellimouse" name="athena-intellimouse">athena-intellimouse</a><br>
If you have an Intellimouse and an X server that supports using the wheel,<br>
then you can use the wheel to scroll the text up and down in gvim. This works<br>
with XFree86 4.0 and later, and with some older versions when you add patches.<br>
See <a class="Identifier" href="scroll.html#scroll-mouse-wheel">scroll-mouse-wheel</a>.<br>
<br>
For older versions of XFree86 you must patch your X server. The following<br>
page has a bit of information about using the Intellimouse on Linux as well as<br>
links to the patches and X server binaries (may not have the one you need<br>
though):<br>
<span class="Constant"><a href="http://www.inria.fr/koala/colas/mouse-wheel-scroll/">http://www.inria.fr/koala/colas/mouse-wheel-scroll/</a></span><br>
<br>
<span class="PreProc">==============================================================================</span><br>
3. Mouse Control <a class="Constant" href="gui.html#gui-mouse" name="gui-mouse">gui-mouse</a><br>
<br>
The mouse only works if the appropriate flag in the <a class="Type" href="options.html#'mouse'">'mouse'</a> option is set.<br>
When the GUI is switched on, and <a class="Type" href="options.html#'mouse'">'mouse'</a> wasn't set yet, the <a class="Type" href="options.html#'mouse'">'mouse'</a> option is<br>
automatically set to "a", enabling it for all modes except for the<br>
<a class="Identifier" href="message.html#hit-enter">hit-enter</a> prompt. If you don't want this, a good place to change the<br>
<a class="Type" href="options.html#'mouse'">'mouse'</a> option is the "gvimrc" file.<br>
<br>
Other options that are relevant:<br>
<a class="Type" href="options.html#'mousefocus'">'mousefocus'</a> window focus follows mouse pointer <a class="Identifier" href="gui.html#gui-mouse-focus">gui-mouse-focus</a><br>
<a class="Type" href="options.html#'mousemodel'">'mousemodel'</a> what mouse button does which action<br>
<a class="Type" href="options.html#'mousehide'">'mousehide'</a> hide mouse pointer while typing text<br>
<a class="Type" href="options.html#'selectmode'">'selectmode'</a> whether to start Select mode or Visual mode<br>
<br>
A quick way to set these is with the ":behave" command.<br>
<a class="Constant" href="gui.html#:behave" name=":behave">:behave</a> <a class="Constant" href="gui.html#:be" name=":be">:be</a><br>
:be[have] <span class="Special">{model}</span> Set behavior for mouse and selection. Valid<br>
arguments are:<br>
mswin MS-Windows behavior<br>
xterm Xterm behavior<br>
<br>
Using ":behave" changes these options:<br>
<span class="PreProc">option mswin xterm</span><br>
<a class="Type" href="options.html#'selectmode'">'selectmode'</a> "mouse,key" ""<br>
<a class="Type" href="options.html#'mousemodel'">'mousemodel'</a> "popup" "extend"<br>
<a class="Type" href="options.html#'keymodel'">'keymodel'</a> "startsel,stopsel" ""<br>
<a class="Type" href="options.html#'selection'">'selection'</a> "exclusive" "inclusive"<br>
<br>
In the $VIMRUNTIME directory, there is a script called <a class="Identifier" href="gui_w32.html#mswin.vim">mswin.vim</a>, which will<br>
also map a few keys to the MS-Windows cut/copy/paste commands. This is NOT<br>
compatible, since it uses the <span class="Special">CTRL-V</span>, <span class="Special">CTRL-X</span> and <span class="Special">CTRL-C</span> keys. If you don't<br>
mind, use this command:<br>
<div class="helpExample"> :so $VIMRUNTIME/mswin.vim</div>
<br>
For scrolling with a wheel on a mouse, see <a class="Identifier" href="scroll.html#scroll-mouse-wheel">scroll-mouse-wheel</a>.<br>
<br>
<br>
3.1 Moving Cursor with Mouse <a class="Constant" href="gui.html#gui-mouse-move" name="gui-mouse-move">gui-mouse-move</a><br>
<br>
Click the left mouse button somewhere in a text buffer where you want the<br>
cursor to go, and it does!<br>
<span class="PreProc">This works in when 'mouse' contains</span><br>
Normal mode 'n' or 'a'<br>
Visual mode 'v' or 'a'<br>
Insert mode 'i' or 'a'<br>
<br>
Select mode is handled like Visual mode.<br>
<br>
You may use this with an operator such as 'd' to delete text from the current<br>
cursor position to the position you point to with the mouse. That is, you hit<br>
'd' and then click the mouse somewhere.<br>
<br>
<a class="Constant" href="gui.html#gui-mouse-focus" name="gui-mouse-focus">gui-mouse-focus</a><br>
The <a class="Type" href="options.html#'mousefocus'">'mousefocus'</a> option can be set to make the keyboard focus follow the<br>
mouse pointer. This means that the window where the mouse pointer is, is the<br>
active window. Warning: this doesn't work very well when using a menu,<br>
because the menu command will always be applied to the top window.<br>
<br>
If you are on the ':' line (or '/' or '?'), then clicking the left or right<br>
mouse button will position the cursor on the ':' line (if <a class="Type" href="options.html#'mouse'">'mouse'</a> contains<br>
'c', 'a' or 'A').<br>
<br>
In any situation the middle mouse button may be clicked to paste the current<br>
selection.<br>
<br>
<br>
3.2 Selection with Mouse <a class="Constant" href="gui.html#gui-mouse-select" name="gui-mouse-select">gui-mouse-select</a><br>
<br>
The mouse can be used to start a selection. How depends on the <a class="Type" href="options.html#'mousemodel'">'mousemodel'</a><br>
option:<br>
<a class="Type" href="options.html#'mousemodel'">'mousemodel'</a> is "extend": use the right mouse button<br>
<a class="Type" href="options.html#'mousemodel'">'mousemodel'</a> is "popup": use the left mouse button, while keeping the Shift<br>
key pressed.<br>
<br>
If there was no selection yet, this starts a selection from the old cursor<br>
position to the position pointed to with the mouse. If there already is a<br>
selection then the closest end will be extended.<br>
<br>
If <a class="Type" href="options.html#'selectmode'">'selectmode'</a> contains "mouse", then the selection will be in Select mode.<br>
This means that typing normal text will replace the selection. See<br>
<a class="Identifier" href="visual.html#Select-mode">Select-mode</a>. Otherwise, the selection will be in Visual mode.<br>
<br>
Double clicking may be done to make the selection word-wise, triple clicking<br>
makes it line-wise, and quadruple clicking makes it rectangular block-wise.<br>
<br>
See <a class="Identifier" href="gui.html#gui-selections">gui-selections</a> on how the selection is used.<br>
<br>
<br>
3.3 Other Text Selection with Mouse <a class="Constant" href="gui.html#gui-mouse-modeless" name="gui-mouse-modeless">gui-mouse-modeless</a><br>
<a class="Constant" href="gui.html#modeless-selection" name="modeless-selection">modeless-selection</a><br>
A different kind of selection is used when:<br>
- in Command-line mode<br>
- in the Command-line window and pointing in another window<br>
- at the <a class="Identifier" href="message.html#hit-enter">hit-enter</a> prompt<br>
- whenever the current mode is not in the <a class="Type" href="options.html#'mouse'">'mouse'</a> option<br>
- when holding the CTRL and SHIFT keys in the GUI<br>
<br>
Since Vim continues like the selection isn't there, and there is no mode<br>
associated with the selection, this is called modeless selection. Any text in<br>
the Vim window can be selected. Select the text by pressing the left mouse<br>
button at the start, drag to the end and release. To extend the selection,<br>
use the right mouse button when <a class="Type" href="options.html#'mousemodel'">'mousemodel'</a> is "extend", or the left mouse<br>
button with the shift key pressed when <a class="Type" href="options.html#'mousemodel'">'mousemodel'</a> is "popup".<br>
The selection is removed when the selected text is scrolled or changed.<br>
<br>
On the command line <span class="Special">CTRL-Y</span> can be used to copy the selection into the<br>
clipboard. To do this from Insert mode, use <span class="Special">CTRL-O</span> : <span class="Special">CTRL-Y</span> <span class="Special"><CR></span>. When<br>
<a class="Type" href="options.html#'guioptions'">'guioptions'</a> contains a or A (default on X11), the selection is automatically<br>
copied to the "* register.<br>
<br>
The middle mouse button can then paste the text. On non-X11 systems, you can<br>
use <span class="Special">CTRL-R</span> +.<br>
<br>
<br>
3.4 Using Mouse on Status Lines <a class="Constant" href="gui.html#gui-mouse-status" name="gui-mouse-status">gui-mouse-status</a><br>
<br>
Clicking the left or right mouse button on the status line below a Vim<br>
window makes that window the current window. This actually happens on button<br>
release (to be able to distinguish a click from a drag action).<br>
<br>
With the left mouse button a status line can be dragged up and down, thus<br>
resizing the windows above and below it. This does not change window focus.<br>
<br>
The same can be used on the vertical separator: click to give the window left<br>
of it focus, drag left and right to make windows wider and narrower.<br>
<br>
<br>
3.5 Various Mouse Clicks <a class="Constant" href="gui.html#gui-mouse-various" name="gui-mouse-various">gui-mouse-various</a><br>
<br>
<span class="Special"><S-LeftMouse></span> Search forward for the word under the mouse click.<br>
When <a class="Type" href="options.html#'mousemodel'">'mousemodel'</a> is "popup" this starts or extends a<br>
selection.<br>
<span class="Special"><S-RightMouse></span> Search backward for the word under the mouse click.<br>
<span class="Special"><C-LeftMouse></span> Jump to the tag name under the mouse click.<br>
<span class="Special"><C-RightMouse></span> Jump back to position before the previous tag jump<br>
(same as "<span class="Special">CTRL-T</span>")<br>
<br>
<br>
3.6 Mouse Mappings <a class="Constant" href="gui.html#gui-mouse-mapping" name="gui-mouse-mapping">gui-mouse-mapping</a><br>
<br>
The mouse events, complete with modifiers, may be mapped. Eg:<br>
<div class="helpExample"> :map <S-LeftMouse> <RightMouse><br>
:map <S-LeftDrag> <RightDrag><br>
:map <S-LeftRelease> <RightRelease><br>
:map <2-S-LeftMouse> <2-RightMouse><br>
:map <2-S-LeftDrag> <2-RightDrag><br>
:map <2-S-LeftRelease> <2-RightRelease><br>
:map <3-S-LeftMouse> <3-RightMouse><br>
:map <3-S-LeftDrag> <3-RightDrag><br>
:map <3-S-LeftRelease> <3-RightRelease><br>
:map <4-S-LeftMouse> <4-RightMouse><br>
:map <4-S-LeftDrag> <4-RightDrag><br>
:map <4-S-LeftRelease> <4-RightRelease></div>
These mappings make selection work the way it probably should in a Motif<br>
application, with shift-left mouse allowing for extending the visual area<br>
rather than the right mouse button.<br>
<br>
Mouse mapping with modifiers does not work for modeless selection.<br>
<br>
<br>
3.7 Drag and drop <a class="Constant" href="gui.html#drag-n-drop" name="drag-n-drop">drag-n-drop</a><br>
<br>
You can drag and drop one or more files into the Vim window, where they will<br>
be opened as if a <a class="Identifier" href="windows.html#:drop">:drop</a> command was used.<br>
<br>
If you hold down Shift while doing this, Vim changes to the first dropped<br>
file's directory. If you hold Ctrl Vim will always split a new window for the<br>
file. Otherwise it's only done if the current buffer has been changed.<br>
<br>
You can also drop a directory on Vim. This starts the explorer plugin for<br>
that directory (assuming it was enabled, otherwise you'll get an error<br>
message). Keep Shift pressed to change to the directory instead.<br>
<br>
If Vim happens to be editing a command line, the names of the dropped files<br>
and directories will be inserted at the cursor. This allows you to use these<br>
names with any Ex command. Special characters (space, tab, double quote and<br>
'|'; backslash on non-MS-Windows systems) will be escaped.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
4. Making GUI Selections <a class="Constant" href="gui.html#gui-selections" name="gui-selections">gui-selections</a><br>
<br>
<a class="Constant" href="gui.html#quotestar" name="quotestar">quotestar</a><br>
You may make selections with the mouse (see <a class="Identifier" href="gui.html#gui-mouse-select">gui-mouse-select</a>), or by using<br>
Vim's Visual mode (see <a class="Identifier" href="visual.html#v">v</a>). If 'a' is present in <a class="Type" href="options.html#'guioptions'">'guioptions'</a>, then<br>
whenever a selection is started (Visual or Select mode), or when the selection<br>
is changed, Vim becomes the owner of the windowing system's primary selection<br>
(on MS-Windows the <a class="Identifier" href="gui_w32.html#gui-clipboard">gui-clipboard</a> is used; under X11, the <a class="Identifier" href="gui_x11.html#x11-selection">x11-selection</a> is<br>
used - you should read whichever of these is appropriate now).<br>
<br>
<a class="Constant" href="gui.html#clipboard" name="clipboard">clipboard</a><br>
There is a special register for storing this selection, it is the "*<br>
register. Nothing is put in here unless the information about what text is<br>
selected is about to change (e.g. with a left mouse click somewhere), or when<br>
another application wants to paste the selected text. Then the text is put<br>
in the "* register. For example, to cut a line and make it the current<br>
selection/put it on the clipboard:<br>
<br>
<div class="helpExample"> "*dd</div>
<br>
Similarly, when you want to paste a selection from another application, e.g.,<br>
by clicking the middle mouse button, the selection is put in the "* register<br>
first, and then <span class="MissingTag">'put'</span> like any other register. For example, to put the<br>
selection (contents of the clipboard):<br>
<br>
<div class="helpExample"> "*p</div>
<br>
When using this register under X11, also see <a class="Identifier" href="gui_x11.html#x11-selection">x11-selection</a>. This also<br>
explains the related "+ register.<br>
<br>
<span class="Todo">Note</span> that when pasting text from one Vim into another separate Vim, the type<br>
of selection (character, line, or block) will also be copied. For other<br>
applications the type is always character. However, if the text gets<br>
transferred via the <a class="Identifier" href="gui_x11.html#x11-cut-buffer">x11-cut-buffer</a>, the selection type is ALWAYS lost.<br>
<br>
When the "unnamed" string is included in the <a class="Type" href="options.html#'clipboard'">'clipboard'</a> option, the unnamed<br>
register is the same as the "* register. Thus you can yank to and paste the<br>
selection without prepending "* to commands.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
5. Menus <a class="Constant" href="gui.html#menus" name="menus">menus</a><br>
<br>
For an introduction see <a class="Identifier" href="usr_42.html">usr_42.txt</a> in the user manual.<br>
<br>
<br>
5.1 Using Menus <a class="Constant" href="gui.html#using-menus" name="using-menus">using-menus</a><br>
<br>
Basically, menus can be used just like mappings. You can define your own<br>
menus, as many as you like.<br>
Long-time Vim users won't use menus much. But the power is in adding your own<br>
menus and menu items. They are most useful for things that you can't remember<br>
what the key sequence was.<br>
<br>
For creating menus in a different language, see <a class="Identifier" href="mlang.html#:menutrans">:menutrans</a>.<br>
<br>
<a class="Constant" href="gui.html#menu.vim" name="menu.vim">menu.vim</a><br>
The default menus are read from the file "$VIMRUNTIME/menu.vim". See<br>
<a class="Identifier" href="starting.html#$VIMRUNTIME">$VIMRUNTIME</a> for where the path comes from. You can set up your own menus.<br>
Starting off with the default set is a good idea. You can add more items, or,<br>
if you don't like the defaults at all, start with removing all menus<br>
<a class="Identifier" href="gui.html#:unmenu-all">:unmenu-all</a>. You can also avoid the default menus being loaded by adding<br>
this line to your .vimrc file (NOT your .gvimrc file!):<br>
<div class="helpExample"> :let did_install_default_menus = 1</div>
If you also want to avoid the Syntax menu:<br>
<div class="helpExample"> :let did_install_syntax_menu = 1</div>
The first item in the Syntax menu can be used to show all available filetypes<br>
in the menu (which can take a bit of time to load). If you want to have all<br>
filetypes already present at startup, add:<br>
<div class="helpExample"> :let do_syntax_sel_menu = 1</div>
<br>
<br>
<a class="Constant" href="gui.html#console-menus" name="console-menus">console-menus</a><br>
Although this documentation is in the GUI section, you can actually use menus<br>
in console mode too. You will have to load <a class="Identifier" href="gui.html#menu.vim">menu.vim</a> explicitly then, it is<br>
not done by default. You can use the <a class="Identifier" href="gui.html#:emenu">:emenu</a> command and command-line<br>
completion with <a class="Type" href="options.html#'wildmenu'">'wildmenu'</a> to access the menu entries almost like a real menu<br>
system. To do this, put these commands in your .vimrc file:<br>
<div class="helpExample"> :source $VIMRUNTIME/menu.vim<br>
:set wildmenu<br>
:set cpo-=<<br>
:set wcm=<C-Z><br>
:map <F4> :emenu <C-Z></div>
Pressing <span class="Special"><F4></span> will start the menu. You can now use the cursor keys to select<br>
a menu entry. Hit <span class="Special"><Enter></span> to execute it. Hit <span class="Special"><Esc></span> if you want to cancel.<br>
This does require the <a class="Identifier" href="various.html#+menu">+menu</a> feature enabled at compile time.<br>
<br>
<a class="Constant" href="gui.html#tear-off-menus" name="tear-off-menus">tear-off-menus</a><br>
GTK+ 2 and Motif support Tear-off menus. These are sort of sticky menus or<br>
pop-up menus that are present all the time. If the resizing does not work<br>
correctly, this may be caused by using something like "Vim*geometry" in the<br>
defaults. Use "Vim.geometry" instead.<br>
<br>
As to GTK+ 3, tear-off menus have been deprecated since GTK+ 3.4.<br>
Accordingly, they are disabled if gvim is linked against GTK+ 3.4 or later.<br>
<br>
The Win32 GUI version emulates Motif's tear-off menus. Actually, a Motif user<br>
will spot the differences easily, but hopefully they're just as useful. You<br>
can also use the <a class="Identifier" href="gui_w32.html#:tearoff">:tearoff</a> command together with <a class="Identifier" href="gui.html#hidden-menus">hidden-menus</a> to create<br>
floating menus that do not appear on the main menu bar.<br>
<br>
<br>
5.2 Creating New Menus <a class="Constant" href="gui.html#creating-menus" name="creating-menus">creating-menus</a><br>
<br>
<a class="Constant" href="gui.html#:me" name=":me">:me</a> <a class="Constant" href="gui.html#:menu" name=":menu">:menu</a> <a class="Constant" href="gui.html#:noreme" name=":noreme">:noreme</a> <a class="Constant" href="gui.html#:noremenu" name=":noremenu">:noremenu</a><br>
<a class="Constant" href="gui.html#:am" name=":am">:am</a> <a class="Constant" href="gui.html#:amenu" name=":amenu">:amenu</a> <a class="Constant" href="gui.html#:an" name=":an">:an</a> <a class="Constant" href="gui.html#:anoremenu" name=":anoremenu">:anoremenu</a><br>
<a class="Constant" href="gui.html#:nme" name=":nme">:nme</a> <a class="Constant" href="gui.html#:nmenu" name=":nmenu">:nmenu</a> <a class="Constant" href="gui.html#:nnoreme" name=":nnoreme">:nnoreme</a> <a class="Constant" href="gui.html#:nnoremenu" name=":nnoremenu">:nnoremenu</a><br>
<a class="Constant" href="gui.html#:ome" name=":ome">:ome</a> <a class="Constant" href="gui.html#:omenu" name=":omenu">:omenu</a> <a class="Constant" href="gui.html#:onoreme" name=":onoreme">:onoreme</a> <a class="Constant" href="gui.html#:onoremenu" name=":onoremenu">:onoremenu</a><br>
<a class="Constant" href="gui.html#:vme" name=":vme">:vme</a> <a class="Constant" href="gui.html#:vmenu" name=":vmenu">:vmenu</a> <a class="Constant" href="gui.html#:vnoreme" name=":vnoreme">:vnoreme</a> <a class="Constant" href="gui.html#:vnoremenu" name=":vnoremenu">:vnoremenu</a><br>
<a class="Constant" href="gui.html#:xme" name=":xme">:xme</a> <a class="Constant" href="gui.html#:xmenu" name=":xmenu">:xmenu</a> <a class="Constant" href="gui.html#:xnoreme" name=":xnoreme">:xnoreme</a> <a class="Constant" href="gui.html#:xnoremenu" name=":xnoremenu">:xnoremenu</a><br>
<a class="Constant" href="gui.html#:sme" name=":sme">:sme</a> <a class="Constant" href="gui.html#:smenu" name=":smenu">:smenu</a> <a class="Constant" href="gui.html#:snoreme" name=":snoreme">:snoreme</a> <a class="Constant" href="gui.html#:snoremenu" name=":snoremenu">:snoremenu</a><br>
<a class="Constant" href="gui.html#:ime" name=":ime">:ime</a> <a class="Constant" href="gui.html#:imenu" name=":imenu">:imenu</a> <a class="Constant" href="gui.html#:inoreme" name=":inoreme">:inoreme</a> <a class="Constant" href="gui.html#:inoremenu" name=":inoremenu">:inoremenu</a><br>
<a class="Constant" href="gui.html#:cme" name=":cme">:cme</a> <a class="Constant" href="gui.html#:cmenu" name=":cmenu">:cmenu</a> <a class="Constant" href="gui.html#:cnoreme" name=":cnoreme">:cnoreme</a> <a class="Constant" href="gui.html#:cnoremenu" name=":cnoremenu">:cnoremenu</a><br>
<a class="Constant" href="gui.html#E330" name="E330">E330</a> <a class="Constant" href="gui.html#E327" name="E327">E327</a> <a class="Constant" href="gui.html#E331" name="E331">E331</a> <a class="Constant" href="gui.html#E336" name="E336">E336</a> <a class="Constant" href="gui.html#E333" name="E333">E333</a><br>
<a class="Constant" href="gui.html#E328" name="E328">E328</a> <a class="Constant" href="gui.html#E329" name="E329">E329</a> <a class="Constant" href="gui.html#E337" name="E337">E337</a> <a class="Constant" href="gui.html#E792" name="E792">E792</a><br>
To create a new menu item, use the ":menu" commands. They are mostly like<br>
the ":map" set of commands but the first argument is a menu item name, given<br>
as a path of menus and submenus with a '.' between them, e.g.:<br>
<br>
<div class="helpExample"> :menu File.Save :w<CR><br>
:inoremenu File.Save <C-O>:w<CR><br>
:menu Edit.Big\ Changes.Delete\ All\ Spaces :%s/[ ^I]//g<CR></div>
<br>
This last one will create a new item in the menu bar called "Edit", holding<br>
the mouse button down on this will pop up a menu containing the item<br>
"Big Changes", which is a sub-menu containing the item "Delete All Spaces",<br>
which when selected, performs the operation.<br>
<br>
Special characters in a menu name:<br>
<br>
& The next character is the shortcut key. Make sure each<br>
shortcut key is only used once in a (sub)menu. If you want to<br>
insert a literal "&" in the menu name use "&&".<br>
<span class="Special"><Tab></span> Separates the menu name from right-aligned text. This can be<br>
used to show the equivalent typed command. The text "<span class="Special"><Tab></span>"<br>
can be used here for convenience. If you are using a real<br>
tab, don't forget to put a backslash before it!<br>
Example:<br>
<br>
<div class="helpExample"> :amenu &File.&Open<Tab>:e :browse e<CR></div>
<br>
[typed literally]<br>
With the shortcut "F" (while keeping the <span class="Special"><Alt></span> key pressed), and then "O",<br>
this menu can be used. The second part is shown as "Open :e". The ":e"<br>
is right aligned, and the "O" is underlined, to indicate it is the shortcut.<br>
<br>
The ":amenu" command can be used to define menu entries for all modes at once.<br>
To make the command work correctly, a character is automatically inserted for<br>
some modes:<br>
<span class="PreProc">mode inserted appended</span><br>
Normal nothing nothing<br>
Visual <span class="Special"><C-C></span> <span class="Special"><C-\><C-G></span><br>
Insert <span class="Special"><C-\><C-O></span><br>
Cmdline <span class="Special"><C-C></span> <span class="Special"><C-\><C-G></span><br>
Op-pending <span class="Special"><C-C></span> <span class="Special"><C-\><C-G></span><br>
<br>
Appending <span class="Special">CTRL-\</span> <span class="Special">CTRL-G</span> is for going back to insert mode when <a class="Type" href="options.html#'insertmode'">'insertmode'</a> is<br>
set. <a class="Identifier" href="intro.html#CTRL-\_CTRL-G">CTRL-\_CTRL-G</a><br>
<br>
Example:<br>
<br>
<div class="helpExample"> :amenu File.Next :next^M</div>
<br>
is equal to:<br>
<br>
<div class="helpExample"> :nmenu File.Next :next^M<br>
:vmenu File.Next ^C:next^M^\^G<br>
:imenu File.Next ^\^O:next^M<br>
:cmenu File.Next ^C:next^M^\^G<br>
:omenu File.Next ^C:next^M^\^G</div>
<br>
Careful: In Insert mode this only works for a SINGLE Normal mode command,<br>
because of the <span class="Special">CTRL-O</span>. If you have two or more commands, you will need to use<br>
the ":imenu" command. For inserting text in any mode, you can use the<br>
expression register:<br>
<br>
<div class="helpExample"> :amenu Insert.foobar "='foobar'<CR>P</div>
<br>
<span class="Todo">Note</span> that the '<' and 'k' flags in <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a> also apply here (when<br>
included they make the <> form and raw key codes not being recognized).<br>
<br>
<span class="Todo">Note</span> that <span class="Special"><Esc></span> in Cmdline mode executes the command, like in a mapping. This<br>
is Vi compatible. Use <span class="Special">CTRL-C</span> to quit Cmdline mode.<br>
<br>
<a class="Constant" href="gui.html#:menu-<silent>" name=":menu-<silent>">:menu-<silent></a> <a class="Constant" href="gui.html#:menu-silent" name=":menu-silent">:menu-silent</a><br>
To define a menu which will not be echoed on the command line, add<br>
"<span class="Special"><silent></span>" as the first argument. Example:<br>
<div class="helpExample"> :menu <silent> Settings.Ignore\ case :set ic<CR></div>
The ":set ic" will not be echoed when using this menu. Messages from the<br>
executed command are still given though. To shut them up too, add a ":silent"<br>
in the executed command:<br>
<div class="helpExample"> :menu <silent> Search.Header :exe ":silent normal /Header\r"<CR></div>
"<span class="Special"><silent></span>" may also appear just after "<span class="Special"><special></span>" or "<span class="Special"><script></span>".<br>
<br>
<a class="Constant" href="gui.html#:menu-<special>" name=":menu-<special>">:menu-<special></a> <a class="Constant" href="gui.html#:menu-special" name=":menu-special">:menu-special</a><br>
Define a menu with <> notation for special keys, even though the "<" flag<br>
may appear in <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>. This is useful if the side effect of setting<br>
<a class="Type" href="options.html#'cpoptions'">'cpoptions'</a> is not desired. Example:<br>
<div class="helpExample"> :menu <special> Search.Header /Header<CR></div>
"<span class="Special"><special></span>" must appear as the very first argument to the ":menu" command or<br>
just after "<span class="Special"><silent></span>" or "<span class="Special"><script></span>".<br>
<br>
<a class="Constant" href="gui.html#:menu-<script>" name=":menu-<script>">:menu-<script></a> <a class="Constant" href="gui.html#:menu-script" name=":menu-script">:menu-script</a><br>
The "to" part of the menu will be inspected for mappings. If you don't want<br>
this, use the ":noremenu" command (or the similar one for a specific mode).<br>
If you do want to use script-local mappings, add "<span class="Special"><script></span>" as the very first<br>
argument to the ":menu" command or just after "<span class="Special"><silent></span>" or "<span class="Special"><special></span>".<br>
<br>
<a class="Constant" href="gui.html#menu-priority" name="menu-priority">menu-priority</a><br>
You can give a priority to a menu. Menus with a higher priority go more to<br>
the right. The priority is given as a number before the ":menu" command.<br>
Example:<br>
<div class="helpExample"> :80menu Buffer.next :bn<CR></div>
<br>
The default menus have these priorities:<br>
File 10<br>
Edit 20<br>
Tools 40<br>
Syntax 50<br>
Buffers 60<br>
Window 70<br>
Help 9999<br>
<br>
When no or zero priority is given, 500 is used.<br>
The priority for the PopUp menu is not used.<br>
<br>
The Help menu will be placed on the far right side of the menu bar on systems<br>
which support this (Motif and GTK+). For GTK+ 2 and 3, this is not done<br>
anymore because right-aligning the Help menu is now discouraged UI design.<br>
<br>
You can use a priority higher than 9999, to make it go after the Help menu,<br>
but that is non-standard and is discouraged. The highest possible priority is<br>
about 32000. The lowest is 1.<br>
<br>
<a class="Constant" href="gui.html#sub-menu-priority" name="sub-menu-priority">sub-menu-priority</a><br>
The same mechanism can be used to position a sub-menu. The priority is then<br>
given as a dot-separated list of priorities, before the menu name:<br>
<div class="helpExample"> :menu 80.500 Buffer.next :bn<CR></div>
Giving the sub-menu priority is only needed when the item is not to be put<br>
in a normal position. For example, to put a sub-menu before the other items:<br>
<div class="helpExample"> :menu 80.100 Buffer.first :brew<CR></div>
Or to put a sub-menu after the other items, and further items with default<br>
priority will be put before it:<br>
<div class="helpExample"> :menu 80.900 Buffer.last :blast<CR></div>
When a number is missing, the default value 500 will be used:<br>
<div class="helpExample"> :menu .900 myMenu.test :echo "text"<CR></div>
The menu priority is only used when creating a new menu. When it already<br>
existed, e.g., in another mode, the priority will not change. Thus, the<br>
priority only needs to be given the first time a menu is used.<br>
An exception is the PopUp menu. There is a separate menu for each mode<br>
(Normal, Op-pending, Visual, Insert, Cmdline). The order in each of these<br>
menus can be different. This is different from menu-bar menus, which have<br>
the same order for all modes.<br>
<span class="Todo">NOTE</span>: sub-menu priorities currently don't work for all versions of the GUI.<br>
<br>
<a class="Constant" href="gui.html#menu-separator" name="menu-separator">menu-separator</a> <a class="Constant" href="gui.html#E332" name="E332">E332</a><br>
Menu items can be separated by a special item that inserts some space between<br>
items. Depending on the system this is displayed as a line or a dotted line.<br>
These items must start with a '-' and end in a '-'. The part in between is<br>
used to give it a unique name. Priorities can be used as with normal items.<br>
Example:<br>
<div class="helpExample"> :menu Example.item1 :do something<br>
:menu Example.-Sep- :<br>
:menu Example.item2 :do something different</div>
<span class="Todo">Note</span> that the separator also requires a rhs. It doesn't matter what it is,<br>
because the item will never be selected. Use a single colon to keep it<br>
simple.<br>
<br>
<a class="Constant" href="gui.html#gui-toolbar" name="gui-toolbar">gui-toolbar</a><br>
The toolbar is currently available in the Win32, Athena, Motif, GTK+ (X11),<br>
and Photon GUI. It should turn up in other GUIs in due course. The<br>
default toolbar is setup in menu.vim.<br>
The display of the toolbar is controlled by the <a class="Type" href="options.html#'guioptions'">'guioptions'</a> letter 'T'. You<br>
can thus have menu & toolbar together, or either on its own, or neither.<br>
The appearance is controlled by the <a class="Type" href="options.html#'toolbar'">'toolbar'</a> option. You can choose between<br>
an image, text or both.<br>
<br>
<a class="Constant" href="gui.html#toolbar-icon" name="toolbar-icon">toolbar-icon</a><br>
The toolbar is defined as a special menu called ToolBar, which only has one<br>
level. Vim interprets the items in this menu as follows:<br>
1) If an "icon=" argument was specified, the file with this name is used.<br>
The file can either be specified with the full path or with the base name.<br>
In the last case it is searched for in the "bitmaps" directory in<br>
<a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>, like in point 3. Examples:<br>
<div class="helpExample"> :amenu icon=/usr/local/pixmaps/foo_icon.xpm ToolBar.Foo :echo "Foo"<CR><br>
:amenu icon=FooIcon ToolBar.Foo :echo "Foo"<CR></div>
<span class="Todo">Note</span> that in the first case the extension is included, while in the second<br>
case it is omitted.<br>
If the file cannot be opened the next points are tried.<br>
A space in the file name must be escaped with a backslash.<br>
A menu priority must come _after_ the icon argument:<br>
<div class="helpExample"> :amenu icon=foo 1.42 ToolBar.Foo :echo "42!"<CR></div>
2) An item called 'BuiltIn##', where ## is a number, is taken as number ## of<br>
the built-in bitmaps available in Vim. Currently there are 31 numbered<br>
from 0 to 30 which cover most common editing operations <a class="Identifier" href="gui.html#builtin-tools">builtin-tools</a>.<br>
<div class="helpExample"> :amenu ToolBar.BuiltIn22 :call SearchNext("back")<CR></div>
3) An item with another name is first searched for in the directory<br>
"bitmaps" in <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>. If found, the bitmap file is used as the<br>
toolbar button image. <span class="Todo">Note</span> that the exact filename is OS-specific: For<br>
example, under Win32 the command<br>
<div class="helpExample"> :amenu ToolBar.Hello :echo "hello"<CR></div>
would find the file 'hello.bmp'. Under GTK+/X11 it is 'Hello.xpm'. With<br>
GTK+ 2 the files 'Hello.png', 'Hello.xpm' and 'Hello.bmp' are checked for<br>
existence, and the first one found would be used.<br>
For MS-Windows and GTK+ 2 the bitmap is scaled to fit the button. For<br>
MS-Windows a size of 18 by 18 pixels works best.<br>
For MS-Windows the bitmap should have 16 colors with the standard palette.<br>
The light grey pixels will be changed to the Window frame color and the<br>
dark grey pixels to the window shadow color. More colors might also work,<br>
depending on your system.<br>
4) If the bitmap is still not found, Vim checks for a match against its list<br>
of built-in names. Each built-in button image has a name.<br>
So the command<br>
<div class="helpExample"> :amenu ToolBar.Open :e</div>
will show the built-in "open a file" button image if no open.bmp exists.<br>
All the built-in names can be seen used in menu.vim.<br>
5) If all else fails, a blank, but functioning, button is displayed.<br>
<br>
<a class="Constant" href="gui.html#builtin-tools" name="builtin-tools">builtin-tools</a><br>
<span class="PreProc">nr Name Normal action </span><br>
00 New open new window<br>
01 Open browse for file to open in current window<br>
02 Save write buffer to file<br>
03 Undo undo last change<br>
04 Redo redo last undone change<br>
05 Cut delete selected text to clipboard<br>
06 Copy copy selected text to clipboard<br>
07 Paste paste text from clipboard<br>
08 Print print current buffer<br>
09 Help open a buffer on Vim's builtin help<br>
10 Find start a search command<br>
11 SaveAll write all modified buffers to file<br>
12 SaveSesn write session file for current situation<br>
13 NewSesn write new session file<br>
14 LoadSesn load session file<br>
15 RunScript browse for file to run as a Vim script<br>
16 Replace prompt for substitute command<br>
17 WinClose close current window<br>
18 WinMax make current window use many lines<br>
19 WinMin make current window use few lines<br>
20 WinSplit split current window<br>
21 Shell start a shell<br>
22 FindPrev search again, backward<br>
23 FindNext search again, forward<br>
24 FindHelp prompt for word to search help for<br>
25 Make run make and jump to first error<br>
26 TagJump jump to tag under the cursor<br>
27 RunCtags build tags for files in current directory<br>
28 WinVSplit split current window vertically<br>
29 WinMaxWidth make current window use many columns<br>
30 WinMinWidth make current window use few columns<br>
<br>
<a class="Constant" href="gui.html#hidden-menus" name="hidden-menus">hidden-menus</a> <a class="Constant" href="gui.html#win32-hidden-menus" name="win32-hidden-menus">win32-hidden-menus</a><br>
In the Win32 and GTK+ GUI, starting a menu name with ']' excludes that menu<br>
from the main menu bar. You must then use the <a class="Identifier" href="gui.html#:popup">:popup</a> or <a class="Identifier" href="gui_w32.html#:tearoff">:tearoff</a> command<br>
to display it.<br>
<br>
<a class="Constant" href="gui.html#popup-menu" name="popup-menu">popup-menu</a><br>
In the Win32, GTK+, Motif, Athena and Photon GUI, you can define the<br>
special menu "PopUp". This is the menu that is displayed when the right mouse<br>
button is pressed, if <a class="Type" href="options.html#'mousemodel'">'mousemodel'</a> is set to popup or popup_setpos.<br>
<br>
<br>
5.3 Showing What Menus Are Mapped To <a class="Constant" href="gui.html#showing-menus" name="showing-menus">showing-menus</a><br>
<br>
To see what an existing menu is mapped to, use just one argument after the<br>
menu commands (just like you would with the ":map" commands). If the menu<br>
specified is a submenu, then all menus under that hierarchy will be shown.<br>
If no argument is given after :menu at all, then ALL menu items are shown<br>
for the appropriate mode (e.g., Command-line mode for :cmenu).<br>
<br>
Special characters in the list, just before the rhs:<br>
* The menu was defined with "nore" to disallow remapping.<br>
& The menu was defined with "<span class="Special"><script></span>" to allow remapping script-local<br>
mappings only.<br>
- The menu was disabled.<br>
<br>
<span class="Todo">Note</span> that hitting <span class="Special"><Tab></span> while entering a menu name after a menu command may<br>
be used to complete the name of the menu item.<br>
<br>
<br>
5.4 Executing Menus <a class="Constant" href="gui.html#execute-menus" name="execute-menus">execute-menus</a><br>
<br>
<a class="Constant" href="gui.html#:em" name=":em">:em</a> <a class="Constant" href="gui.html#:emenu" name=":emenu">:emenu</a> <a class="Constant" href="gui.html#E334" name="E334">E334</a> <a class="Constant" href="gui.html#E335" name="E335">E335</a><br>
:<span class="Special">[range]</span>em[enu] <span class="Special">{menu}</span> Execute <span class="Special">{menu}</span> from the command line.<br>
The default is to execute the Normal mode<br>
menu. If a range is specified, it executes<br>
the Visual mode menu.<br>
If used from <span class="Special"><c-o></span>, it executes the<br>
insert-mode menu Eg:<br>
<div class="helpExample"> :emenu File.Exit</div>
<br>
If the console-mode vim has been compiled with WANT_MENU defined, you can<br>
use :emenu to access useful menu items you may have got used to from GUI<br>
mode. See <a class="Type" href="options.html#'wildmenu'">'wildmenu'</a> for an option that works well with this. See<br>
<a class="Identifier" href="gui.html#console-menus">console-menus</a> for an example.<br>
<br>
When using a range, if the lines match with '<,'>, then the menu is executed<br>
using the last visual selection.<br>
<br>
<br>
5.5 Deleting Menus <a class="Constant" href="gui.html#delete-menus" name="delete-menus">delete-menus</a><br>
<br>
<a class="Constant" href="gui.html#:unme" name=":unme">:unme</a> <a class="Constant" href="gui.html#:unmenu" name=":unmenu">:unmenu</a><br>
<a class="Constant" href="gui.html#:aun" name=":aun">:aun</a> <a class="Constant" href="gui.html#:aunmenu" name=":aunmenu">:aunmenu</a><br>
<a class="Constant" href="gui.html#:nunme" name=":nunme">:nunme</a> <a class="Constant" href="gui.html#:nunmenu" name=":nunmenu">:nunmenu</a><br>
<a class="Constant" href="gui.html#:ounme" name=":ounme">:ounme</a> <a class="Constant" href="gui.html#:ounmenu" name=":ounmenu">:ounmenu</a><br>
<a class="Constant" href="gui.html#:vunme" name=":vunme">:vunme</a> <a class="Constant" href="gui.html#:vunmenu" name=":vunmenu">:vunmenu</a><br>
<a class="Constant" href="gui.html#:xunme" name=":xunme">:xunme</a> <a class="Constant" href="gui.html#:xunmenu" name=":xunmenu">:xunmenu</a><br>
<a class="Constant" href="gui.html#:sunme" name=":sunme">:sunme</a> <a class="Constant" href="gui.html#:sunmenu" name=":sunmenu">:sunmenu</a><br>
<a class="Constant" href="gui.html#:iunme" name=":iunme">:iunme</a> <a class="Constant" href="gui.html#:iunmenu" name=":iunmenu">:iunmenu</a><br>
<a class="Constant" href="gui.html#:cunme" name=":cunme">:cunme</a> <a class="Constant" href="gui.html#:cunmenu" name=":cunmenu">:cunmenu</a><br>
To delete a menu item or a whole submenu, use the unmenu commands, which are<br>
analogous to the unmap commands. Eg:<br>
<div class="helpExample"> :unmenu! Edit.Paste</div>
<br>
This will remove the Paste item from the Edit menu for Insert and<br>
Command-line modes.<br>
<br>
<span class="Todo">Note</span> that hitting <span class="Special"><Tab></span> while entering a menu name after an umenu command<br>
may be used to complete the name of the menu item for the appropriate mode.<br>
<br>
To remove all menus use: <a class="Constant" href="gui.html#:unmenu-all" name=":unmenu-all">:unmenu-all</a> <br>
<div class="helpExample"> :unmenu * " remove all menus in Normal and visual mode<br>
:unmenu! * " remove all menus in Insert and Command-line mode<br>
:aunmenu * " remove all menus in all modes</div>
<br>
If you want to get rid of the menu bar:<br>
<div class="helpExample"> :set guioptions-=m</div>
<br>
<br>
5.6 Disabling Menus <a class="Constant" href="gui.html#disable-menus" name="disable-menus">disable-menus</a><br>
<br>
<a class="Constant" href="gui.html#:menu-disable" name=":menu-disable">:menu-disable</a> <a class="Constant" href="gui.html#:menu-enable" name=":menu-enable">:menu-enable</a><br>
If you do not want to remove a menu, but disable it for a moment, this can be<br>
done by adding the "enable" or "disable" keyword to a ":menu" command.<br>
Examples:<br>
<div class="helpExample"> :menu disable &File.&Open\.\.\.<br>
:amenu enable *<br>
:amenu disable &Tools.*</div>
<br>
The command applies to the modes as used with all menu commands. <span class="Todo">Note</span> that<br>
characters like "&" need to be included for translated names to be found.<br>
When the argument is "*", all menus are affected. Otherwise the given menu<br>
name and all existing submenus below it are affected.<br>
<br>
<br>
5.7 Examples for Menus <a class="Constant" href="gui.html#menu-examples" name="menu-examples">menu-examples</a><br>
<br>
Here is an example on how to add menu items with menu's! You can add a menu<br>
item for the keyword under the cursor. The register "z" is used.<br>
<br>
<div class="helpExample"> :nmenu Words.Add\ Var wb"zye:menu! Words.<C-R>z <C-R>z<CR><br>
:nmenu Words.Remove\ Var wb"zye:unmenu! Words.<C-R>z<CR><br>
:vmenu Words.Add\ Var "zy:menu! Words.<C-R>z <C-R>z <CR><br>
:vmenu Words.Remove\ Var "zy:unmenu! Words.<C-R>z<CR><br>
:imenu Words.Add\ Var <Esc>wb"zye:menu! Words.<C-R>z <C-R>z<CR>a<br>
:imenu Words.Remove\ Var <Esc>wb"zye:unmenu! Words.<C-R>z<CR>a</div>
<br>
(the rhs is in <> notation, you can copy/paste this text to try out the<br>
mappings, or put these lines in your gvimrc; "<span class="Special"><C-R></span>" is <span class="Special">CTRL-R</span>, "<span class="Special"><CR></span>" is<br>
the <span class="Special"><CR></span> key. <a class="Identifier" href="intro.html#<>"><></a>)<br>
<br>
<br>
5.8 Tooltips & Menu tips<br>
<br>
See section <a class="Identifier" href="usr_42.html#42.4">42.4</a> in the user manual.<br>
<br>
<a class="Constant" href="gui.html#:tmenu" name=":tmenu">:tmenu</a> <a class="Constant" href="gui.html#:tm" name=":tm">:tm</a><br>
:tm[enu] <span class="Special">{menupath}</span> <span class="Special">{rhs}</span> Define a tip for a menu or tool. <span class="Special">{only in</span><br>
<span class="Special">X11 and Win32 GUI}</span><br>
<br>
:tm[enu] <span class="Special">[menupath]</span> List menu tips. <span class="Special">{only in X11 and Win32 GUI}</span><br>
<br>
<a class="Constant" href="gui.html#:tunmenu" name=":tunmenu">:tunmenu</a> <a class="Constant" href="gui.html#:tu" name=":tu">:tu</a><br>
:tu[nmenu] <span class="Special">{menupath}</span> Remove a tip for a menu or tool.<br>
<span class="Special">{only in X11 and Win32 GUI}</span><br>
<br>
When a tip is defined for a menu item, it appears in the command-line area<br>
when the mouse is over that item, much like a standard Windows menu hint in<br>
the status bar. (Except when Vim is in Command-line mode, when of course<br>
nothing is displayed.)<br>
When a tip is defined for a ToolBar item, it appears as a tooltip when the<br>
mouse pauses over that button, in the usual fashion. Use the <a class="Identifier" href="syntax.html#hl-Tooltip">hl-Tooltip</a><br>
highlight group to change its colors.<br>
<br>
A "tip" can be defined for each menu item. For example, when defining a menu<br>
item like this:<br>
<div class="helpExample"> :amenu MyMenu.Hello :echo "Hello"<CR></div>
The tip is defined like this:<br>
<div class="helpExample"> :tmenu MyMenu.Hello Displays a greeting.</div>
And delete it with:<br>
<div class="helpExample"> :tunmenu MyMenu.Hello</div>
<br>
Tooltips are currently only supported for the X11 and Win32 GUI. However, they<br>
should appear for the other gui platforms in the not too distant future.<br>
<br>
The ":tmenu" command works just like other menu commands, it uses the same<br>
arguments. ":tunmenu" deletes an existing menu tip, in the same way as the<br>
other unmenu commands.<br>
<br>
If a menu item becomes invalid (i.e. its actions in all modes are deleted) Vim<br>
deletes the menu tip (and the item) for you. This means that :aunmenu deletes<br>
a menu item - you don't need to do a :tunmenu as well.<br>
<br>
<br>
5.9 Popup Menus<br>
<br>
In the Win32 and GTK+ GUI, you can cause a menu to popup at the cursor.<br>
This behaves similarly to the PopUp menus except that any menu tree can<br>
be popped up.<br>
<br>
This command is for backwards compatibility, using it is discouraged, because<br>
it behaves in a strange way.<br>
<br>
<a class="Constant" href="gui.html#:popup" name=":popup">:popup</a> <a class="Constant" href="gui.html#:popu" name=":popu">:popu</a><br>
:popu[p] <span class="Special">{name}</span> Popup the menu <span class="Special">{name}</span>. The menu named must<br>
have at least one subentry, but need not<br>
appear on the menu-bar (see <a class="Identifier" href="gui.html#hidden-menus">hidden-menus</a>).<br>
<span class="Special">{only available for Win32 and GTK GUI}</span><br>
<br>
:popu[p]! <span class="Special">{name}</span> Like above, but use the position of the mouse<br>
pointer instead of the cursor.<br>
<br>
Example:<br>
<div class="helpExample"> :popup File</div>
will make the "File" menu (if there is one) appear at the text cursor (mouse<br>
pointer if ! was used).<br>
<br>
<div class="helpExample"> :amenu ]Toolbar.Make :make<CR><br>
:popup ]Toolbar</div>
This creates a popup menu that doesn't exist on the main menu-bar.<br>
<br>
<span class="Todo">Note</span> that a menu that starts with ']' will not be displayed.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
6. Extras <a class="Constant" href="gui.html#gui-extras" name="gui-extras">gui-extras</a><br>
<br>
This section describes other features which are related to the GUI.<br>
<br>
- With the GUI, there is no wait for one second after hitting escape, because<br>
the key codes don't start with <span class="Special"><Esc></span>.<br>
<br>
- Typing ^V followed by a special key in the GUI will insert "<span class="Special"><Key></span>", since<br>
the internal string used is meaningless. Modifiers may also be held down to<br>
get "<span class="Special"><Modifiers-Key></span>".<br>
<br>
- In the GUI, the modifiers SHIFT, CTRL, and ALT (or META) may be used within<br>
mappings of special keys and mouse events. E.g.: :map <span class="Special"><M-LeftDrag></span> <span class="Special"><LeftDrag></span><br>
<br>
- In the GUI, several normal keys may have modifiers in mappings etc, these<br>
are <span class="Special"><Space></span>, <span class="Special"><Tab></span>, <span class="Special"><NL></span>, <span class="Special"><CR></span>, <span class="Special"><Esc></span>.<br>
<br>
- To check in a Vim script if the GUI is being used, you can use something<br>
like this:<br>
<br>
<div class="helpExample"> if has("gui_running")<br>
echo "yes, we have a GUI"<br>
else<br>
echo "Boring old console"<br>
endif</div>
<a class="Constant" href="gui.html#setting-guifont" name="setting-guifont">setting-guifont</a><br>
- When you use the same vimrc file on various systems, you can use something<br>
like this to set options specifically for each type of GUI:<br>
<br>
<div class="helpExample"> if has("gui_running")<br>
if has("gui_gtk2")<br>
:set guifont=Luxi\ Mono\ 12<br>
elseif has("x11")<br>
" Also for GTK 1<br>
:set guifont=*-lucidatypewriter-medium-r-normal-*-*-180-*-*-m-*-*<br>
elseif has("gui_win32")<br>
:set guifont=Luxi_Mono:h12:cANSI<br>
endif<br>
endif</div>
<br>
A recommended Japanese font is MS Mincho. You can find info here:<br>
<span class="Constant"><a href="http://www.lexikan.com/mincho.htm">http://www.lexikan.com/mincho.htm</a></span><br>
<br>
<span class="PreProc">==============================================================================</span><br>
7. Shell Commands <a class="Constant" href="gui.html#gui-shell" name="gui-shell">gui-shell</a><br>
<br>
For the X11 GUI the external commands are executed inside the gvim window.<br>
See <a class="Identifier" href="gui_x11.html#gui-pty">gui-pty</a>.<br>
<br>
WARNING: Executing an external command from the X11 GUI will not always<br>
work. "normal" commands like "ls", "grep" and "make" mostly work fine.<br>
Commands that require an intelligent terminal like "less" and "ispell" won't<br>
work. Some may even hang and need to be killed from another terminal. So be<br>
careful!<br>
<br>
For the Win32 GUI the external commands are executed in a separate window.<br>
See <a class="Identifier" href="gui_w32.html#gui-shell-win32">gui-shell-win32</a>.<br>
<br>
vim:tw=78:sw=4:ts=8:ft=help:norl:<br>
</div>
</article>
<footer>
<a href="#top">Return to the top</a> - <a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
<br />
<div style="text-align:right;">
Hosted by <a href="https://github.com/vim-jp/vimdoc-en">vimdoc-en project</a><br />
If you met any problem, please report it to <a href="https://github.com/vim-jp/vimdoc-en/issues">issue</a>.<br />
</div>
</footer>
<!--<script src="js/check-referrer.js" type="text/javascript"></script>-->
</body>
</html>
<!-- vim:set ts=8 sts=2 sw=2 tw=0 et: -->
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。