代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>gui_w32 - 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_w32<br />
<a name="top"></a><h1>gui_w32 - 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_w32.html" name="gui_w32.txt">gui_w32.txt</a> For <span class="Identifier">Vim version 8.0.</span> Last change: 2014 Dec 20<br>
<br>
<br>
<span class="Identifier">VIM REFERENCE MANUAL by Bram Moolenaar</span><br>
<br>
<br>
Vim's Win32 Graphical User Interface <a class="Constant" href="gui_w32.html#gui-w32" name="gui-w32">gui-w32</a> <a class="Constant" href="gui_w32.html#win32-gui" name="win32-gui">win32-gui</a><br>
<br>
1. Starting the GUI <a class="Identifier" href="gui_w32.html#gui-w32-start">gui-w32-start</a><br>
2. Vim as default editor <a class="Identifier" href="gui_w32.html#vim-default-editor">vim-default-editor</a><br>
3. Using the clipboard <a class="Identifier" href="gui_w32.html#gui-clipboard">gui-clipboard</a><br>
4. Shell Commands <a class="Identifier" href="gui_w32.html#gui-shell-win32">gui-shell-win32</a><br>
5. Special colors <a class="Identifier" href="gui_w32.html#win32-colors">win32-colors</a><br>
6. Windows dialogs & browsers <a class="Identifier" href="gui_w32.html#gui-w32-dialogs">gui-w32-dialogs</a><br>
7. Command line arguments <a class="Identifier" href="gui_w32.html#gui-w32-cmdargs">gui-w32-cmdargs</a><br>
8. Various <a class="Identifier" href="gui_w32.html#gui-w32-various">gui-w32-various</a><br>
<br>
Other relevant documentation:<br>
<a class="Identifier" href="gui.html">gui.txt</a> For generic items of the GUI.<br>
<a class="Identifier" href="os_win32.html">os_win32.txt</a> For Win32 specific items.<br>
<br>
<span class="Special">{Vi does not have a Windows GUI}</span><br>
<br>
<span class="PreProc">==============================================================================</span><br>
1. Starting the GUI <a class="Constant" href="gui_w32.html#gui-w32-start" name="gui-w32-start">gui-w32-start</a><br>
<br>
The Win32 GUI version of Vim will always start the GUI, no matter how you<br>
start it or what it's called.<br>
<br>
The GUI will always run in the Windows subsystem. Mostly shells automatically<br>
return with a command prompt after starting gvim. If not, you should use the<br>
"start" command:<br>
<div class="helpExample"> start gvim [options] file ..</div>
<br>
<span class="Todo">Note</span>: All fonts (bold, italic) must be of the same size!!! If you don't do<br>
this, text will disappear or mess up the display. Vim does not check the font<br>
sizes. It's the size in screen pixels that must be the same. <span class="Todo">Note</span> that some<br>
fonts that have the same point size don't have the same pixel size!<br>
Additionally, the positioning of the fonts must be the same (ascent and<br>
descent).<br>
<br>
The Win32 GUI has an extra menu item: "Edit/Select Font". It brings up the<br>
standard Windows font selector.<br>
<br>
Setting the menu height doesn't work for the Win32 GUI.<br>
<br>
<a class="Constant" href="gui_w32.html#gui-win32-maximized" name="gui-win32-maximized">gui-win32-maximized</a><br>
If you want Vim to start with a maximized window, add this command to your<br>
vimrc or gvimrc file:<br>
<div class="helpExample"> au GUIEnter * simalt ~x</div>
<br>
<br>
Using Vim as a plugin <a class="Constant" href="gui_w32.html#gui-w32-windowid" name="gui-w32-windowid">gui-w32-windowid</a><br>
<br>
When gvim starts up normally, it creates its own top level window. If you<br>
pass Vim the command-line option <a class="Identifier" href="starting.html#--windowid">--windowid</a> with a decimal or hexadecimal<br>
value, Vim will create a window that is a child of the window with the given<br>
ID. This enables Vim to act as a plugin in another application. This really<br>
is a programmer's interface, and is of no use without a supporting application<br>
to spawn Vim correctly.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
2. Vim as default editor <a class="Constant" href="gui_w32.html#vim-default-editor" name="vim-default-editor">vim-default-editor</a><br>
<br>
To set Vim as the default editor for a file type:<br>
1. Start a Windows Explorer<br>
2. Choose View/Options -> File Types<br>
3. Select the path to gvim for every file type that you want to use it for.<br>
(you can also use three spaces in the file type field, for files without an<br>
extension).<br>
In the "open" action, use:<br>
<div class="helpExample"> gvim "%1"</div>
The quotes are required for using file names with embedded spaces.<br>
You can also use this:<br>
<div class="helpExample"> gvim "%L"</div>
This should avoid short (8.3 character) file names in some situations. But<br>
I'm not sure if this works everywhere.<br>
<br>
When you open a file in Vim by double clicking it, Vim changes to that<br>
file's directory.<br>
<br>
If you want Vim to start full-screen, use this for the Open action:<br>
<div class="helpExample"> gvim -c "simalt ~x" "%1"</div>
<br>
Another method, which also works when you put Vim in another directory (e.g.,<br>
when you have got a new version):<br>
1. select a file you want to use Vim with<br>
2. <span class="Special"><Shift-F10></span><br>
3. select "Open With..." menu entry<br>
4. click "Other..."<br>
5. browse to the (new) location of Vim and click "Open"<br>
6. make "Always Use this program..." checked<br>
7. <span class="Special"><OK></span><br>
<br>
<a class="Constant" href="gui_w32.html#send-to-menu" name="send-to-menu">send-to-menu</a> <a class="Constant" href="gui_w32.html#sendto" name="sendto">sendto</a><br>
You can also install Vim in the "Send To" menu:<br>
1. Start a Windows Explorer<br>
2. Navigate to your sendto directory:<br>
Windows NT: %windir%\profiles\%user%\sendto (e.g.<br>
"c:\winnt\profiles\mattha\sendto")<br>
Windows XP: C:\Documents and Settings\%user%\SendTo<br>
Windows Vista: C:\Users\%user%\AppData\Roaming\Microsoft\Windows\SendTo .<br>
3. Right-click in the file pane and select New->Shortcut<br>
4. Follow the shortcut wizard, using the full path to VIM/GVIM.<br>
<br>
When you 'send a file to Vim', Vim changes to that file's directory. <span class="Todo">Note</span>,<br>
however, that any long directory names will appear in their short (MS-DOS)<br>
form. This is a limitation of the Windows "Send To" mechanism.<br>
<br>
<a class="Constant" href="gui_w32.html#notepad" name="notepad">notepad</a><br>
You could replace notepad.exe with gvim.exe, but that has a few side effects.<br>
Some programs rely on notepad arguments, which are not recognized by Vim. For<br>
example "notepad -p" is used by some applications to print a file. It's<br>
better to leave notepad where it is and use another way to start Vim.<br>
<br>
<a class="Constant" href="gui_w32.html#win32-popup-menu" name="win32-popup-menu">win32-popup-menu</a><br>
A more drastic approach is to install an "Edit with Vim" entry in the popup<br>
menu for the right mouse button. With this you can edit any file with Vim.<br>
<br>
This can co-exist with the file associations mentioned above. The difference<br>
is that the file associations will make starting Vim the default action. With<br>
the "Edit with Vim" menu entry you can keep the existing file association for<br>
double clicking on the file, and edit the file with Vim when you want. For<br>
example, you can associate "*.mak" with your make program. You can execute<br>
the makefile by double clicking it and use the "Edit with Vim" entry to edit<br>
the makefile.<br>
<br>
You can select any files and right-click to see a menu option called "Edit<br>
with gvim". Choosing this menu option will invoke gvim with the file you have<br>
selected. If you select multiple files, you will find two gvim-related menu<br>
options:<br>
"Edit with multiple gvims" -- one gvim for each file in the selection<br>
"Edit with single gvim" -- one gvim for all the files in the selection<br>
And if there already is a gvim running:<br>
"Edit with existing gvim" -- edit the file with the running gvim<br>
<br>
The "edit with existing Vim" entries can be disabled by adding an entry in the<br>
registry under HKLM\Software\Vim\Gvim, named DisableEditWithExisting, and with<br>
any value.<br>
<a class="Constant" href="gui_w32.html#install-registry" name="install-registry">install-registry</a><br>
You can add the "Edit with Vim" menu entry in an easy way by using the<br>
"install.exe" program. It will add several registry entries for you.<br>
<br>
You can also do this by hand. This is complicated! Use the install.exe if<br>
you can.<br>
<br>
1. Start the registry editor with "regedit".<br>
2. Add these keys:<br>
<span class="PreProc">key value name value</span><br>
HKEY_CLASSES_ROOT\CLSID\<span class="Special">{51EEE242-AD87-11d3-9C1E-0090278BBD99}</span><br>
<span class="Special">{default}</span> Vim Shell Extension<br>
HKEY_CLASSES_ROOT\CLSID\<span class="Special">{51EEE242-AD87-11d3-9C1E-0090278BBD99}</span>\InProcServer32<br>
<span class="Special">{default}</span> <span class="Special">{path}</span>\gvimext.dll<br>
ThreadingModel Apartment<br>
HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim<br>
<span class="Special">{default}</span> <span class="Special">{51EEE242-AD87-11d3-9C1E-0090278BBD99}</span><br>
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved<br>
<span class="Special">{51EEE242-AD87-11d3-9C1E-0090278BBD99}</span><br>
Vim Shell Extension<br>
HKEY_LOCAL_MACHINE\Software\Vim\Gvim<br>
path <span class="Special">{path}</span>\gvim.exe<br>
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\vim 5.6<br>
DisplayName Vim 5.6: Edit with Vim popup menu entry<br>
UninstallString <span class="Special">{path}</span>\uninstal.exe<br>
<br>
Replace <span class="Special">{path}</span> with the path that leads to the executable.<br>
Don't type <span class="Special">{default}</span>, this is the value for the key itself.<br>
<br>
To remove "Edit with Vim" from the popup menu, just remove the registry<br>
entries mentioned above. The "uninstal.exe" program can do this for you. You<br>
can also use the entry in the Windows standard "Add/Remove Programs" list.<br>
<br>
If you notice that this entry overrules other file type associations, set<br>
those associations again by hand (using Windows Explorer, see above). This<br>
only seems to happen on some Windows NT versions (Windows bug?). Procedure:<br>
1. Find the name of the file type. This can be done by starting the registry<br>
editor, and searching for the extension in \\HKEY_CLASSES_ROOT<br>
2. In a Windows Explorer, use View/Options/File Types. Search for the file<br>
type in the list and click "Edit". In the actions list, you can select on<br>
to be used as the default (normally the "open" action) and click on the<br>
"Set Default" button.<br>
<br>
<br>
Vim in the "Open With..." context menu <a class="Constant" href="gui_w32.html#win32-open-with-menu" name="win32-open-with-menu">win32-open-with-menu</a><br>
<br>
If you use the Vim install program you have the choice to add Vim to the "Open<br>
With..." menu. This means you can use Vim to edit many files. Not every file<br>
(for unclear reasons...), thus the "Edit with Vim" menu entry is still useful.<br>
<br>
One reason to add this is to be able to edit HTML files directly from Internet<br>
Explorer. To enable this use the "Tools" menu, "Internet Options..." entry.<br>
In the dialog select the "Programs" tab and select Vim in the "HTML editor"<br>
choice. If it's not there than installing didn't work properly.<br>
<br>
Doing this manually can be done with this script:<br>
<br>
<span class="PreProc">----------------------------------------------------------</span><br>
REGEDIT4<br>
<br>
[HKEY_CLASSES_ROOT\Applications\gvim.exe]<br>
<br>
[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell]<br>
<br>
[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit]<br>
<br>
[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit\command]<br>
@="c:\\vim\\vim62\\gvim.exe \"%1\""<br>
<br>
[HKEY_CLASSES_ROOT\.htm\OpenWithList\gvim.exe]<br>
<br>
[HKEY_CLASSES_ROOT\*\OpenWithList\gvim.exe]<br>
<br>
<span class="PreProc">----------------------------------------------------------</span><br>
<br>
Change the "c:\\vim\\vim62" bit to where gvim.exe is actually located.<br>
<br>
To uninstall this run the Vim uninstall program or manually delete the<br>
registry entries with "regedit".<br>
<br>
<span class="PreProc">==============================================================================</span><br>
3. Using the clipboard <a class="Constant" href="gui_w32.html#gui-clipboard" name="gui-clipboard">gui-clipboard</a><br>
<br>
Windows has a clipboard, where you can copy text to, and paste text from. Vim<br>
supports this in several ways. For other systems see <a class="Identifier" href="gui.html#gui-selections">gui-selections</a>.<br>
<br>
The "* register reflects the contents of the clipboard. <a class="Identifier" href="gui.html#quotestar">quotestar</a><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. Thus you can yank to and paste from the clipboard<br>
without prepending "* to commands.<br>
<br>
The 'a' flag in <a class="Type" href="options.html#'guioptions'">'guioptions'</a> is not included by default. This means that text<br>
is only put on the clipboard when an operation is performed on it. Just<br>
Visually selecting text doesn't put it on the clipboard. When the 'a' flag is<br>
included, the text is copied to the clipboard even when it is not operated<br>
upon.<br>
<br>
<a class="Constant" href="gui_w32.html#mswin.vim" name="mswin.vim">mswin.vim</a><br>
To use the standard MS-Windows way of <span class="Special">CTRL-X</span>, <span class="Special">CTRL-C</span> and <span class="Special">CTRL-V</span>, use the<br>
$VIMRUNTIME/mswin.vim script. You could add this line to your _vimrc file:<br>
<div class="helpExample"> source $VIMRUNTIME/mswin.vim</div>
<br>
Since <span class="Special">CTRL-C</span> is used to copy the text to the clipboard, it can't be used to<br>
cancel an operation. Use <span class="Special">CTRL-Break</span> for that.<br>
<br>
<span class="Special">CTRL-Z</span> is used for undo. This means you can't suspend Vim with this key, use<br>
<a class="Identifier" href="starting.html#:suspend">:suspend</a> instead (if it's supported at all).<br>
<br>
<a class="Constant" href="gui_w32.html#CTRL-V-alternative" name="CTRL-V-alternative">CTRL-V-alternative</a> <a class="Constant" href="gui_w32.html#CTRL-Q" name="CTRL-Q">CTRL-Q</a><br>
Since <span class="Special">CTRL-V</span> is used to paste, you can't use it to start a blockwise Visual<br>
selection. You can use <span class="Special">CTRL-Q</span> instead. You can also use <span class="Special">CTRL-Q</span> in Insert<br>
mode and Command-line mode to get the old meaning of <span class="Special">CTRL-V</span>. But <span class="Special">CTRL-Q</span><br>
doesn't work for terminals when it's used for control flow.<br>
<br>
<span class="Todo">NOTE</span>: The clipboard support still has a number of bugs. See <a class="Identifier" href="todo.html#todo">todo</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
4. Shell Commands <a class="Constant" href="gui_w32.html#gui-shell-win32" name="gui-shell-win32">gui-shell-win32</a><br>
<br>
Vim uses another window for external commands, to make it possible to run any<br>
command. The external command gets its own environment for running, just like<br>
it was started from a DOS prompt.<br>
<br>
<a class="Constant" href="gui_w32.html#win32-vimrun" name="win32-vimrun">win32-vimrun</a><br>
Executing an external command is done indirectly by the "vimrun" command. The<br>
"vimrun.exe" must be in the path for this to work. Or it must be in the same<br>
directory as the Vim executable. If "vimrun" cannot be found, the command is<br>
executed directly, but then the DOS window closes immediately after the<br>
external command has finished.<br>
WARNING: If you close this window with the "X" button, and confirm the<br>
question if you really want to kill the application, Vim may be killed too!<br>
(This does not apply to commands run asynchronously with ":!start".)<br>
<br>
The window in which the commands are executed will be the default you have set<br>
up for "Console" in Control Panel.<br>
<br>
<a class="Constant" href="gui_w32.html#win32-!start" name="win32-!start">win32-!start</a><br>
Normally, Vim waits for a command to complete before continuing (this makes<br>
sense for most shell commands which produce output for Vim to use). If you<br>
want Vim to start a program and return immediately, you can use the following<br>
syntax:<br>
<div class="helpExample"> :!start [/min] {command}</div>
The optional "/min" causes the window to be minimized.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
5. Special colors <a class="Constant" href="gui_w32.html#win32-colors" name="win32-colors">win32-colors</a><br>
<br>
On Win32, the normal DOS colors can be used. See <a class="Identifier" href="os_dos.html#dos-colors">dos-colors</a>.<br>
<br>
Additionally the system configured colors can also be used. These are known<br>
by the names Sys_XXX, where XXX is the appropriate system color name, from the<br>
following list (see the Win32 documentation for full descriptions). Case is<br>
ignored.<br>
<br>
Sys_3DDKShadow Sys_3DFace Sys_BTNFace<br>
Sys_3DHilight Sys_3DHighlight Sys_BTNHilight<br>
Sys_BTNHighlight Sys_3DLight Sys_3DShadow<br>
Sys_BTNShadow Sys_ActiveBorder Sys_ActiveCaption<br>
Sys_AppWorkspace Sys_Background Sys_Desktop<br>
Sys_BTNText Sys_CaptionText Sys_GrayText<br>
Sys_Highlight Sys_HighlightText Sys_InactiveBorder<br>
Sys_InactiveCaption Sys_InactiveCaptionText Sys_InfoBK<br>
Sys_InfoText Sys_Menu Sys_MenuText<br>
Sys_ScrollBar Sys_Window Sys_WindowFrame<br>
Sys_WindowText<br>
<br>
Probably the most useful values are<br>
Sys_Window Normal window background<br>
Sys_WindowText Normal window text<br>
Sys_Highlight Highlighted background<br>
Sys_HighlightText Highlighted text<br>
<br>
These extra colors are also available:<br>
Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet,<br>
<br>
<a class="Constant" href="gui_w32.html" name="rgb.txt">rgb.txt</a><br>
Additionally, colors defined by a "rgb.txt" file can be used. This file is<br>
well known from X11. A few lines from it:<br>
<br>
<div class="helpExample"> 255 218 185 peach puff<br>
205 133 63 peru<br>
255 181 197 pink</div>
<br>
This shows the layout of the file: First the R, G and B value as a decimal<br>
number, followed by the name of the color. The four fields are separated by<br>
spaces.<br>
<br>
You can get an rgb.txt file from any X11 distribution. It is located in a<br>
directory like "/usr/X11R6/lib/X11/". For Vim it must be located in the<br>
$VIMRUNTIME directory. Thus the file can be found with "$VIMRUNTIME/rgb.txt".<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="gui_w32.html#gui-w32-dialogs" name="gui-w32-dialogs">gui-w32-dialogs</a> <a class="Constant" href="gui_w32.html#dialog" name="dialog">dialog</a><br>
6. Windows dialogs & browsers<br>
<br>
The Win32 GUI can use familiar Windows components for some operations, as well<br>
as the traditional interface shared with the console version.<br>
<br>
<br>
6.1 Dialogs<br>
<br>
The dialogs displayed by the "confirm" family (i.e. the <a class="Type" href="options.html#'confirm'">'confirm'</a> option,<br>
<a class="Identifier" href="editing.html#:confirm">:confirm</a> command and <a class="Identifier" href="eval.html#confirm()">confirm()</a> function) are GUI-based rather than the<br>
console-based ones used by other versions. The 'c' flag in <a class="Type" href="options.html#'guioptions'">'guioptions'</a><br>
changes this.<br>
<br>
<br>
6.2 File Browsers<br>
<br>
When prepending ":browse" before file editing commands, a file requester is<br>
used to allow you to select an existing file. See <a class="Identifier" href="editing.html#:browse">:browse</a>.<br>
<br>
<br>
6.3 Tearoff Menus<br>
<br>
The Win32 GUI emulates Motif's tear-off menus. At the top of each menu you<br>
will see a small graphic "rip here" sign. Selecting it will cause a floating<br>
window to be created with the same menu entries on it. The floating menu can<br>
then be accessed just as if it was the original (including sub-menus), but<br>
without having to go to the menu bar each time.<br>
This is most useful if you find yourself using a command buried in a sub-menu<br>
over and over again.<br>
The tearoff menus can be positioned where you like, and always stay just above<br>
the Main Vim window. You can get rid of them by closing them as usual; they<br>
also of course close when you exit Vim.<br>
<br>
<a class="Constant" href="gui_w32.html#:tearoff" name=":tearoff">:tearoff</a> <a class="Constant" href="gui_w32.html#:te" name=":te">:te</a><br>
:te[aroff] <span class="Special">{name}</span> Tear-off the menu <span class="Special">{name}</span>. The menu named must have at<br>
least one subentry, but need not appear on the<br>
menu-bar (see <a class="Identifier" href="gui.html#win32-hidden-menus">win32-hidden-menus</a>).<br>
<br>
Example:<br>
<div class="helpExample"> :tearoff File</div>
will make the "File" menu (if there is one) appear as a tearoff menu.<br>
<br>
<div class="helpExample"> :amenu ]Toolbar.Make :make<CR><br>
:tearoff ]Toolbar</div>
This creates a floating 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>
7. Command line arguments <a class="Constant" href="gui_w32.html#gui-w32-cmdargs" name="gui-w32-cmdargs">gui-w32-cmdargs</a><br>
<br>
Analysis of a command line into parameters is not standardised in MS Windows.<br>
Gvim has to provide logic to analyse a command line. This logic is likely to<br>
be different from the default logic provided by a compilation system used to<br>
build vim. The differences relate to unusual double quote (") usage.<br>
The arguments "C:\My Music\freude.txt" and "+/Sch\"iller" are handled in the<br>
same way. The argument "+/Sch""iller" may be handled different by gvim and<br>
vim, depending what it was compiled with.<br>
<br>
The rules are:<br>
a) A parameter is a sequence of graphic characters.<br>
b) Parameters are separated by white space.<br>
c) A parameter can be enclosed in double quotes to include white space.<br>
d) A sequence of zero or more backslashes (\) and a double quote (")<br>
is special. The effective number of backslashes is halved, rounded<br>
down. An even number of backslashes reverses the acceptability of<br>
spaces and tabs, an odd number of backslashes produces a literal<br>
double quote.<br>
<br>
So:<br>
" is a special double quote<br>
\" is a literal double quote<br>
\\" is a literal backslash and a special double quote<br>
\\\" is a literal backslash and a literal double quote<br>
\\\\" is 2 literal backslashes and a special double quote<br>
\\\\\" is 2 literal backslashes and a literal double quote<br>
etc.<br>
<br>
Example:<br>
<div class="helpExample"> gvim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\"</div>
<br>
opens "C:\My Music\freude" and executes the line mode commands:<br>
<div class="helpExample"> set ignorecase; /"foo\ and /bar\"</div>
<br>
<span class="PreProc">==============================================================================</span><br>
8. Various <a class="Constant" href="gui_w32.html#gui-w32-various" name="gui-w32-various">gui-w32-various</a><br>
<br>
<a class="Constant" href="gui_w32.html#gui-w32-printing" name="gui-w32-printing">gui-w32-printing</a><br>
The "File/Print" menu prints the text with syntax highlighting, see<br>
<a class="Identifier" href="print.html#:hardcopy">:hardcopy</a>. If you just want to print the raw text and have a default<br>
printer installed this should also work:<br>
<div class="helpExample"> :w >>prn</div>
<br>
Vim supports a number of standard MS Windows features. Some of these are<br>
detailed elsewhere: see <a class="Identifier" href="options.html#'mouse'">'mouse'</a>, <a class="Identifier" href="gui.html#win32-hidden-menus">win32-hidden-menus</a>.<br>
<br>
<a class="Constant" href="gui_w32.html#drag-n-drop-win32" name="drag-n-drop-win32">drag-n-drop-win32</a><br>
You can drag and drop one or more files into the Vim window, where they will<br>
be opened as normal. See <a class="Identifier" href="gui.html#drag-n-drop">drag-n-drop</a>.<br>
<br>
<a class="Constant" href="gui_w32.html#:simalt" name=":simalt">:simalt</a> <a class="Constant" href="gui_w32.html#:sim" name=":sim">:sim</a><br>
:sim[alt] <span class="Special">{key}</span> simulate pressing <span class="Special">{key}</span> while holding Alt pressed.<br>
<span class="Special">{not in Vi}</span> <span class="Special">{only for Win32 versions}</span><br>
<span class="Todo">Note</span>: ":si" means ":s" with the "i" flag.<br>
<br>
Normally, Vim takes control of all Alt-<span class="Special"><Key></span> combinations, to increase the<br>
number of possible mappings. This clashes with the standard use of Alt as the<br>
key for accessing menus.<br>
The quick way of getting standard behavior is to set the <a class="Type" href="options.html#'winaltkeys'">'winaltkeys'</a> option<br>
to "yes". This however prevents you from mapping Alt keys at all.<br>
Another way is to set <a class="Type" href="options.html#'winaltkeys'">'winaltkeys'</a> to "menu". Menu shortcut keys are then<br>
handled by windows, other ALT keys can be mapped. This doesn't allow a<br>
dependency on the current state though.<br>
To get round this, the :simalt command allows Vim (when <a class="Type" href="options.html#'winaltkeys'">'winaltkeys'</a> is not<br>
"yes") to fake a Windows-style Alt keypress. You can use this to map Alt key<br>
combinations (or anything else for that matter) to produce standard Windows<br>
actions. Here are some examples:<br>
<br>
<div class="helpExample"> :map <M-f> :simalt f<CR></div>
This makes Alt-F pop down the 'File' menu (with the stock Menu.vim) by<br>
simulating the keystrokes Alt, F.<br>
<div class="helpExample"> :map <M-Space> :simalt ~<CR></div>
This maps Alt-Space to pop down the system menu for the Vim window. <span class="Todo">Note</span> that<br>
~ is used by simalt to represent the <span class="Special"><Space></span> character.<br>
<div class="helpExample"> :map <C-n> :simalt ~n<CR></div>
Maps Control-<span class="Special">N</span> to produce the keys Alt-Space followed by <span class="Special">N</span>. This minimizes the<br>
Vim window via the system menu.<br>
<br>
<span class="Todo">Note</span> that the key changes depending on the language you are using.<br>
<br>
<a class="Constant" href="gui_w32.html#intellimouse-wheel-problems" name="intellimouse-wheel-problems">intellimouse-wheel-problems</a><br>
When using the Intellimouse mouse wheel causes Vim to stop accepting input, go<br>
to:<br>
ControlPanel - Mouse - Wheel - UniversalScrolling - Exceptions<br>
<br>
And add gvim to the list of applications. This problem only appears to happen<br>
with the Intellimouse driver 2.2 and when "Universal Scrolling" is turned on.<br>
<br>
<br>
XPM support <a class="Constant" href="gui_w32.html#w32-xpm-support" name="w32-xpm-support">w32-xpm-support</a><br>
<br>
Gvim can be build on MS-Windows with support for XPM files. <a class="Identifier" href="various.html#+xpm_w32">+xpm_w32</a><br>
See the Make_mvc.mak file for instructions, search for XPM.<br>
<br>
To try out if XPM support works do this:<br>
<div class="helpExample"> :help<br>
:exe 'sign define vimxpm icon=' . $VIMRUNTIME . '\\vim16x16.xpm'<br>
:exe 'sign place 1 line=1 name=vimxpm file=' . expand('%:p')</div>
<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: -->
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。