代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>usr_09 - 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>
/ usr_09<br />
<a name="top"></a><h1>usr_09 - 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="usr_09.html" name="usr_09.txt">usr_09.txt</a> For <span class="Identifier">Vim version 8.0.</span> Last change: 2006 Apr 24<br>
<br>
VIM USER MANUAL - by Bram Moolenaar<br>
<br>
Using the GUI<br>
<br>
<br>
Vim works in an ordinary terminal. GVim can do the same things and a few<br>
more. The GUI offers menus, a toolbar, scrollbars and other items. This<br>
chapter is about these extra things that the GUI offers.<br>
<br>
<a class="Identifier" href="usr_09.html#09.1">09.1</a> Parts of the GUI<br>
<a class="Identifier" href="usr_09.html#09.2">09.2</a> Using the mouse<br>
<a class="Identifier" href="usr_09.html#09.3">09.3</a> The clipboard<br>
<a class="Identifier" href="usr_09.html#09.4">09.4</a> Select mode<br>
<br>
Next chapter: <a class="Identifier" href="usr_10.html">usr_10.txt</a> Making big changes<br>
Previous chapter: <a class="Identifier" href="usr_08.html">usr_08.txt</a> Splitting windows<br>
Table of contents: <a class="Identifier" href="usr_toc.html">usr_toc.txt</a><br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_09.html#09.1" name="09.1">09.1</a> Parts of the GUI<br>
<br>
You might have an icon on your desktop that starts gVim. Otherwise, one of<br>
these commands should do it:<br>
<br>
<div class="helpExample"> gvim file.txt<br>
vim -g file.txt</div>
<br>
If this doesn't work you don't have a version of Vim with GUI support. You<br>
will have to install one first.<br>
Vim will open a window and display "file.txt" in it. What the window looks<br>
like depends on the version of Vim. It should resemble the following picture<br>
(for as far as this can be shown in ASCII!).<br>
<br>
+----------------------------------------------------+<br>
| file.txt + (~/dir) - VIM X | <- window title<br>
+----------------------------------------------------+<br>
| File Edit Tools Syntax Buffers Window Help | <- menubar<br>
+----------------------------------------------------+<br>
| aaa bbb ccc ddd eee fff ggg hhh iii jjj | <- toolbar<br>
| aaa bbb ccc ddd eee fff ggg hhh iii jjj |<br>
+----------------------------------------------------+<br>
| file text | ^ |<br>
| ~ | # |<br>
| ~ | # | <- scrollbar<br>
| ~ | # |<br>
| ~ | # |<br>
| ~ | # |<br>
| | V |<br>
+----------------------------------------------------+<br>
<br>
The largest space is occupied by the file text. This shows the file in the<br>
same way as in a terminal. With some different colors and another font<br>
perhaps.<br>
<br>
<br>
THE WINDOW TITLE<br>
<br>
At the very top is the window title. This is drawn by your window system.<br>
Vim will set the title to show the name of the current file. First comes the<br>
name of the file. Then some special characters and the directory of the file<br>
in parens. These special character can be present:<br>
<br>
- The file cannot be modified (e.g., a help file)<br>
+ The file contains changes<br>
= The file is read-only<br>
=+ The file is read-only, contains changes anyway<br>
<br>
If nothing is shown you have an ordinary, unchanged file.<br>
<br>
<br>
THE MENUBAR<br>
<br>
You know how menus work, right? Vim has the usual items, plus a few more.<br>
Browse them to get an idea of what you can use them for. A relevant submenu<br>
is Edit/Global Settings. You will find these entries:<br>
<br>
Toggle Toolbar make the toolbar appear/disappear<br>
Toggle Bottom Scrollbar make a scrollbar appear/disappear at the bottom<br>
Toggle Left Scrollbar make a scrollbar appear/disappear at the left<br>
Toggle Right Scrollbar make a scrollbar appear/disappear at the right<br>
<br>
On most systems you can tear-off the menus. Select the top item of the menu,<br>
the one that looks like a dashed line. You will get a separate window with<br>
the items of the menu. It will hang around until you close the window.<br>
<br>
<br>
THE TOOLBAR<br>
<br>
This contains icons for the most often used actions. Hopefully the icons are<br>
self-explanatory. There are tooltips to get an extra hint (move the mouse<br>
pointer to the icon without clicking and don't move it for a second).<br>
<br>
The "Edit/Global Settings/Toggle Toolbar" menu item can be used to make the<br>
toolbar disappear. If you never want a toolbar, use this command in your<br>
vimrc file:<br>
<br>
<div class="helpExample"> :set guioptions-=T</div>
<br>
This removes the 'T' flag from the <a class="Type" href="options.html#'guioptions'">'guioptions'</a> option. Other parts of the<br>
GUI can also be enabled or disabled with this option. See the help for it.<br>
<br>
<br>
THE SCROLLBARS<br>
<br>
By default there is one scrollbar on the right. It does the obvious thing.<br>
When you split the window, each window will get its own scrollbar.<br>
You can make a horizontal scrollbar appear with the menu item<br>
Edit/Global Settings/Toggle Bottom Scrollbar. This is useful in diff mode, or<br>
when the <a class="Type" href="options.html#'wrap'">'wrap'</a> option has been reset (more about that later).<br>
<br>
When there are vertically split windows, only the windows on the right side<br>
will have a scrollbar. However, when you move the cursor to a window on the<br>
left, it will be this one the that scrollbar controls. This takes a bit of<br>
time to get used to.<br>
When you work with vertically split windows, consider adding a scrollbar on<br>
the left. This can be done with a menu item, or with the <a class="Type" href="options.html#'guioptions'">'guioptions'</a> option:<br>
<br>
<div class="helpExample"> :set guioptions+=l</div>
<br>
This adds the 'l' flag to <a class="Type" href="options.html#'guioptions'">'guioptions'</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_09.html#09.2" name="09.2">09.2</a> Using the mouse<br>
<br>
Standards are wonderful. In Microsoft Windows, you can use the mouse to<br>
select text in a standard manner. The X Window system also has a standard<br>
system for using the mouse. Unfortunately, these two standards are not the<br>
same.<br>
Fortunately, you can customize Vim. You can make the behavior of the mouse<br>
work like an X Window system mouse or a Microsoft Windows mouse. The following<br>
command makes the mouse behave like an X Window mouse:<br>
<br>
<div class="helpExample"> :behave xterm</div>
<br>
The following command makes the mouse work like a Microsoft Windows mouse:<br>
<br>
<div class="helpExample"> :behave mswin</div>
<br>
The default behavior of the mouse on UNIX systems is xterm. The default<br>
behavior on a Microsoft Windows system is selected during the installation<br>
process. For details about what the two behaviors are, see <a class="Identifier" href="gui.html#:behave">:behave</a>. Here<br>
follows a summary.<br>
<br>
<br>
XTERM MOUSE BEHAVIOR<br>
<br>
Left mouse click position the cursor<br>
Left mouse drag select text in Visual mode<br>
Middle mouse click paste text from the clipboard<br>
Right mouse click extend the selected text until the mouse<br>
pointer<br>
<br>
<br>
MSWIN MOUSE BEHAVIOR<br>
<br>
Left mouse click position the cursor<br>
Left mouse drag select text in Select mode (see <a class="Identifier" href="usr_09.html#09.4">09.4</a>)<br>
Left mouse click, with Shift extend the selected text until the mouse<br>
pointer<br>
Middle mouse click paste text from the clipboard<br>
Right mouse click display a pop-up menu<br>
<br>
<br>
The mouse can be further tuned. Check out these options if you want to change<br>
the way how the mouse works:<br>
<br>
<a class="Type" href="options.html#'mouse'">'mouse'</a> in which mode the mouse is used by Vim<br>
<a class="Type" href="options.html#'mousemodel'">'mousemodel'</a> what effect a mouse click has<br>
<a class="Type" href="options.html#'mousetime'">'mousetime'</a> time between clicks for a double-click<br>
<a class="Type" href="options.html#'mousehide'">'mousehide'</a> hide the mouse while typing<br>
<a class="Type" href="options.html#'selectmode'">'selectmode'</a> whether the mouse starts Visual or Select mode<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_09.html#09.3" name="09.3">09.3</a> The clipboard<br>
<br>
In section <a class="Identifier" href="usr_04.html#04.7">04.7</a> the basic use of the clipboard was explained. There is one<br>
essential thing to explain about X-windows: There are actually two places to<br>
exchange text between programs. MS-Windows doesn't have this.<br>
<br>
In X-Windows there is the "current selection". This is the text that is<br>
currently highlighted. In Vim this is the Visual area (this assumes you are<br>
using the default option settings). You can paste this selection in another<br>
application without any further action.<br>
For example, in this text select a few words with the mouse. Vim will<br>
switch to Visual mode and highlight the text. Now start another gVim, without<br>
a file name argument, so that it displays an empty window. Click the middle<br>
mouse button. The selected text will be inserted.<br>
<br>
The "current selection" will only remain valid until some other text is<br>
selected. After doing the paste in the other gVim, now select some characters<br>
in that window. You will notice that the words that were previously selected<br>
in the other gvim window are displayed differently. This means that it no<br>
longer is the current selection.<br>
<br>
You don't need to select text with the mouse, using the keyboard commands for<br>
Visual mode works just as well.<br>
<br>
<br>
THE REAL CLIPBOARD<br>
<br>
Now for the other place with which text can be exchanged. We call this the<br>
"real clipboard", to avoid confusion. Often both the "current selection" and<br>
the "real clipboard" are called clipboard, you'll have to get used to that.<br>
To put text on the real clipboard, select a few different words in one of<br>
the gVims you have running. Then use the Edit/Copy menu entry. Now the text<br>
has been copied to the real clipboard. You can't see this, unless you have<br>
some application that shows the clipboard contents (e.g., KDE's klipper).<br>
Now select the other gVim, position the cursor somewhere and use the<br>
Edit/Paste menu. You will see the text from the real clipboard is inserted.<br>
<br>
<br>
USING BOTH<br>
<br>
This use of both the "current selection" and the "real clipboard" might sound<br>
a bit confusing. But it is very useful. Let's show this with an example.<br>
Use one gvim with a text file and perform these actions:<br>
<br>
- Select two words in Visual mode.<br>
- Use the Edit/Copy menu to get these words onto the clipboard.<br>
- Select one other word in Visual mode.<br>
- Use the Edit/Paste menu item. What will happen is that the single selected<br>
word is replaced with the two words from the clipboard.<br>
- Move the mouse pointer somewhere else and click the middle button. You<br>
will see that the word you just overwrote with the clipboard is inserted<br>
here.<br>
<br>
If you use the "current selection" and the "real clipboard" with care, you can<br>
do a lot of useful editing with them.<br>
<br>
<br>
USING THE KEYBOARD<br>
<br>
If you don't like using the mouse, you can access the current selection and<br>
the real clipboard with two registers. The "* register is for the current<br>
selection.<br>
To make text become the current selection, use Visual mode. For example,<br>
to select a whole line just press "V".<br>
To insert the current selection before the cursor:<br>
<br>
<div class="helpExample"> "*P</div>
<br>
Notice the uppercase "P". The lowercase "p" puts the text after the cursor.<br>
<br>
The "+ register is used for the real clipboard. For example, to copy the text<br>
from the cursor position until the end of the line to the clipboard:<br>
<br>
<div class="helpExample"> "+y$</div>
<br>
Remember, "y" is yank, which is Vim's copy command.<br>
To insert the contents of the real clipboard before the cursor:<br>
<br>
<div class="helpExample"> "+P</div>
<br>
It's the same as for the current selection, but uses the plus (+) register<br>
instead of the star (*) register.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_09.html#09.4" name="09.4">09.4</a> Select mode<br>
<br>
And now something that is used more often on MS-Windows than on X-Windows.<br>
But both can do it. You already know about Visual mode. Select mode is like<br>
Visual mode, because it is also used to select text. But there is an obvious<br>
difference: When typing text, the selected text is deleted and the typed text<br>
replaces it.<br>
<br>
To start working with Select mode, you must first enable it (for MS-Windows<br>
it is probably already enabled, but you can do this anyway):<br>
<br>
<div class="helpExample"> :set selectmode+=mouse</div>
<br>
Now use the mouse to select some text. It is highlighted like in Visual mode.<br>
Now press a letter. The selected text is deleted, and the single letter<br>
replaces it. You are in Insert mode now, thus you can continue typing.<br>
<br>
Since typing normal text causes the selected text to be deleted, you can not<br>
use the normal movement commands "hjkl", "w", etc. Instead, use the shifted<br>
function keys. <span class="Special"><S-Left></span> (shifted cursor left key) moves the cursor left. The<br>
selected text is changed like in Visual mode. The other shifted cursor keys<br>
do what you expect. <span class="Special"><S-End></span> and <span class="Special"><S-Home></span> also work.<br>
<br>
You can tune the way Select mode works with the <a class="Type" href="options.html#'selectmode'">'selectmode'</a> option.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<br>
Next chapter: <a class="Identifier" href="usr_10.html">usr_10.txt</a> Making big changes<br>
<br>
Copyright: see <a class="Identifier" href="usr_01.html#manual-copyright">manual-copyright</a> vim:tw=78: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: -->
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。