代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>usr_20 - 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_20<br />
<a name="top"></a><h1>usr_20 - 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_20.html" name="usr_20.txt">usr_20.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>
Typing command-line commands quickly<br>
<br>
<br>
Vim has a few generic features that makes it easier to enter commands. Colon<br>
commands can be abbreviated, edited and repeated. Completion is available for<br>
nearly everything.<br>
<br>
<a class="Identifier" href="usr_20.html#20.1">20.1</a> Command line editing<br>
<a class="Identifier" href="usr_20.html#20.2">20.2</a> Command line abbreviations<br>
<a class="Identifier" href="usr_20.html#20.3">20.3</a> Command line completion<br>
<a class="Identifier" href="usr_20.html#20.4">20.4</a> Command line history<br>
<a class="Identifier" href="usr_20.html#20.5">20.5</a> Command line window<br>
<br>
Next chapter: <a class="Identifier" href="usr_21.html">usr_21.txt</a> Go away and come back<br>
Previous chapter: <a class="Identifier" href="usr_12.html">usr_12.txt</a> Clever tricks<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_20.html#20.1" name="20.1">20.1</a> Command line editing<br>
<br>
When you use a colon (:) command or search for a string with / or ?, Vim puts<br>
the cursor on the bottom of the screen. There you type the command or search<br>
pattern. This is called the Command line. Also when it's used for entering a<br>
search command.<br>
<br>
The most obvious way to edit the command you type is by pressing the <span class="Special"><BS></span> key.<br>
This erases the character before the cursor. To erase another character,<br>
typed earlier, first move the cursor with the cursor keys.<br>
For example, you have typed this:<br>
<br>
<div class="helpExample"> :s/col/pig/</div>
<br>
Before you hit <span class="Special"><Enter></span>, you notice that "col" should be "cow". To correct<br>
this, you type <span class="Special"><Left></span> five times. The cursor is now just after "col". Type<br>
<span class="Special"><BS></span> and "w" to correct:<br>
<br>
<div class="helpExample"> :s/cow/pig/</div>
<br>
Now you can press <span class="Special"><Enter></span> directly. You don't have to move the cursor to the<br>
end of the line before executing the command.<br>
<br>
The most often used keys to move around in the command line:<br>
<br>
<span class="Special"><Left></span> one character left<br>
<span class="Special"><Right></span> one character right<br>
<span class="Special"><S-Left></span> or <span class="Special"><C-Left></span> one word left<br>
<span class="Special"><S-Right></span> or <span class="Special"><C-Right></span> one word right<br>
<span class="Special">CTRL-B</span> or <span class="Special"><Home></span> to begin of command line<br>
<span class="Special">CTRL-E</span> or <span class="Special"><End></span> to end of command line<br>
<br>
<span class="Todo">Note</span>:<br>
<span class="Special"><S-Left></span> (cursor left key with Shift key pressed) and <span class="Special"><C-Left></span> (cursor<br>
left key with Control pressed) will not work on all keyboards. Same<br>
for the other Shift and Control combinations.<br>
<br>
You can also use the mouse to move the cursor.<br>
<br>
<br>
DELETING<br>
<br>
As mentioned, <span class="Special"><BS></span> deletes the character before the cursor. To delete a whole<br>
word use <span class="Special">CTRL-W</span>.<br>
<br>
<span class="PreProc">/the fine pig</span><br>
<br>
<span class="Special">CTRL-W</span><br>
<br>
<span class="PreProc">/the fine</span><br>
<br>
<span class="Special">CTRL-U</span> removes all text, thus allows you to start all over again.<br>
<br>
<br>
OVERSTRIKE<br>
<br>
The <span class="Special"><Insert></span> key toggles between inserting characters and replacing the<br>
existing ones. Start with this text:<br>
<br>
<span class="PreProc">/the fine pig</span><br>
<br>
Move the cursor to the start of "fine" with <span class="Special"><S-Left></span> twice (or <span class="Special"><Left></span> eight<br>
times, if <span class="Special"><S-Left></span> doesn't work). Now press <span class="Special"><Insert></span> to switch to overstrike<br>
and type "great":<br>
<br>
<span class="PreProc">/the greatpig</span><br>
<br>
Oops, we lost the space. Now, don't use <span class="Special"><BS></span>, because it would delete the<br>
"t" (this is different from Replace mode). Instead, press <span class="Special"><Insert></span> to switch<br>
from overstrike to inserting, and type the space:<br>
<br>
<span class="PreProc">/the great pig</span><br>
<br>
<br>
CANCELLING<br>
<br>
You thought of executing a : or / command, but changed your mind. To get rid<br>
of what you already typed, without executing it, press <span class="Special">CTRL-C</span> or <span class="Special"><Esc></span>.<br>
<br>
<span class="Todo">Note</span>:<br>
<span class="Special"><Esc></span> is the universal "get out" key. Unfortunately, in the good old<br>
Vi pressing <span class="Special"><Esc></span> in a command line executed the command! Since that<br>
might be considered to be a bug, Vim uses <span class="Special"><Esc></span> to cancel the command.<br>
But with the <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a> option it can be made Vi compatible. And<br>
when using a mapping (which might be written for Vi) <span class="Special"><Esc></span> also works<br>
Vi compatible. Therefore, using <span class="Special">CTRL-C</span> is a method that always works.<br>
<br>
If you are at the start of the command line, pressing <span class="Special"><BS></span> will cancel the<br>
command. It's like deleting the ":" or "/" that the line starts with.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_20.html#20.2" name="20.2">20.2</a> Command line abbreviations<br>
<br>
Some of the ":" commands are really long. We already mentioned that<br>
":substitute" can be abbreviated to ":s". This is a generic mechanism, all<br>
":" commands can be abbreviated.<br>
<br>
How short can a command get? There are 26 letters, and many more commands.<br>
For example, ":set" also starts with ":s", but ":s" doesn't start a ":set"<br>
command. Instead ":set" can be abbreviated to ":se".<br>
When the shorter form of a command could be used for two commands, it<br>
stands for only one of them. There is no logic behind which one, you have to<br>
learn them. In the help files the shortest form that works is mentioned. For<br>
example:<br>
<br>
<div class="helpExample"> :s[ubstitute]</div>
<br>
This means that the shortest form of ":substitute" is ":s". The following<br>
characters are optional. Thus ":su" and ":sub" also work.<br>
<br>
In the user manual we will either use the full name of command, or a short<br>
version that is still readable. For example, ":function" can be abbreviated<br>
to ":fu". But since most people don't understand what that stands for, we<br>
will use ":fun". (Vim doesn't have a ":funny" command, otherwise ":fun" would<br>
be confusing too.)<br>
<br>
It is recommended that in Vim scripts you write the full command name. That<br>
makes it easier to read back when you make later changes. Except for some<br>
often used commands like ":w" (":write") and ":r" (":read").<br>
A particularly confusing one is ":end", which could stand for ":endif",<br>
":endwhile" or ":endfunction". Therefore, always use the full name.<br>
<br>
<br>
SHORT OPTION NAMES<br>
<br>
In the user manual the long version of the option names is used. Many options<br>
also have a short name. Unlike ":" commands, there is only one short name<br>
that works. For example, the short name of <a class="Type" href="options.html#'autoindent'">'autoindent'</a> is <a class="Type" href="options.html#'ai'">'ai'</a>. Thus these<br>
two commands do the same thing:<br>
<br>
<div class="helpExample"> :set autoindent<br>
:set ai</div>
<br>
You can find the full list of long and short names here: <a class="Identifier" href="quickref.html#option-list">option-list</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_20.html#20.3" name="20.3">20.3</a> Command line completion<br>
<br>
This is one of those Vim features that, by itself, is a reason to switch from<br>
Vi to Vim. Once you have used this, you can't do without.<br>
<br>
Suppose you have a directory that contains these files:<br>
<br>
info.txt<br>
intro.txt<br>
bodyofthepaper.txt<br>
<br>
To edit the last one, you use the command:<br>
<br>
<div class="helpExample"> :edit bodyofthepaper.txt</div>
<br>
It's easy to type this wrong. A much quicker way is:<br>
<br>
<div class="helpExample"> :edit b<Tab></div>
<br>
Which will result in the same command. What happened? The <span class="Special"><Tab></span> key does<br>
completion of the word before the cursor. In this case "b". Vim looks in the<br>
directory and finds only one file that starts with a "b". That must be the<br>
one you are looking for, thus Vim completes the file name for you.<br>
<br>
Now type:<br>
<br>
<div class="helpExample"> :edit i<Tab></div>
<br>
Vim will beep, and give you:<br>
<br>
<div class="helpExample"> :edit info.txt</div>
<br>
The beep means that Vim has found more than one match. It then uses the first<br>
match it found (alphabetically). If you press <span class="Special"><Tab></span> again, you get:<br>
<br>
<div class="helpExample"> :edit intro.txt</div>
<br>
Thus, if the first <span class="Special"><Tab></span> doesn't give you the file you were looking for, press<br>
it again. If there are more matches, you will see them all, one at a time.<br>
If you press <span class="Special"><Tab></span> on the last matching entry, you will go back to what you<br>
first typed:<br>
<br>
<div class="helpExample"> :edit i</div>
<br>
Then it starts all over again. Thus Vim cycles through the list of matches.<br>
Use <span class="Special">CTRL-P</span> to go through the list in the other direction:<br>
<br>
<------------------- <span class="Special"><Tab></span> -------------------------+<br>
|<br>
<span class="Special"><Tab></span> --> <span class="Special"><Tab></span> --><br>
:edit i :edit info.txt :edit intro.txt<br>
<-- <span class="Special">CTRL-P</span> <-- <span class="Special">CTRL-P</span><br>
|<br>
+---------------------- <span class="Special">CTRL-P</span> ------------------------><br>
<br>
<br>
CONTEXT<br>
<br>
When you type ":set i" instead of ":edit i" and press <span class="Special"><Tab></span> you get:<br>
<br>
<div class="helpExample"> :set icon</div>
<br>
Hey, why didn't you get ":set info.txt"? That's because Vim has context<br>
sensitive completion. The kind of words Vim will look for depends on the<br>
command before it. Vim knows that you cannot use a file name just after a<br>
":set" command, but you can use an option name.<br>
Again, if you repeat typing the <span class="Special"><Tab></span>, Vim will cycle through all matches.<br>
There are quite a few, it's better to type more characters first:<br>
<br>
<div class="helpExample"> :set isk<Tab></div>
<br>
Gives:<br>
<br>
<div class="helpExample"> :set iskeyword</div>
<br>
Now type "=" and press <span class="Special"><Tab></span>:<br>
<br>
<div class="helpExample"> :set iskeyword=@,48-57,_,192-255</div>
<br>
What happens here is that Vim inserts the old value of the option. Now you<br>
can edit it.<br>
What is completed with <span class="Special"><Tab></span> is what Vim expects in that place. Just try<br>
it out to see how it works. In some situations you will not get what you<br>
want. That's either because Vim doesn't know what you want, or because<br>
completion was not implemented for that situation. In that case you will get<br>
a <span class="Special"><Tab></span> inserted (displayed as ^I).<br>
<br>
<br>
LIST MATCHES<br>
<br>
When there are many matches, you would like to see an overview. Do this by<br>
pressing <span class="Special">CTRL-D</span>. For example, pressing <span class="Special">CTRL-D</span> after:<br>
<br>
<div class="helpExample"> :set is</div>
<br>
results in:<br>
<br>
<div class="helpExample"> :set is<br>
incsearch isfname isident iskeyword isprint<br>
:set is</div>
<br>
Vim lists the matches and then comes back with the text you typed. You can<br>
now check the list for the item you wanted. If it isn't there, you can use<br>
<span class="Special"><BS></span> to correct the word. If there are many matches, type a few more<br>
characters before pressing <span class="Special"><Tab></span> to complete the rest.<br>
If you have watched carefully, you will have noticed that "incsearch"<br>
doesn't start with "is". In this case "is" stands for the short name of<br>
"incsearch". (Many options have a short and a long name.) Vim is clever<br>
enough to know that you might have wanted to expand the short name of the<br>
option into the long name.<br>
<br>
<br>
THERE IS MORE<br>
<br>
The <span class="Special">CTRL-L</span> command completes the word to the longest unambiguous string. If<br>
you type ":edit i" and there are files "info.txt" and "info_backup.txt" you<br>
will get ":edit info".<br>
<br>
The <a class="Type" href="options.html#'wildmode'">'wildmode'</a> option can be used to change the way completion works.<br>
The <a class="Type" href="options.html#'wildmenu'">'wildmenu'</a> option can be used to get a menu-like list of matches.<br>
Use the <a class="Type" href="options.html#'suffixes'">'suffixes'</a> option to specify files that are less important and appear<br>
at the end of the list of files.<br>
The <a class="Type" href="options.html#'wildignore'">'wildignore'</a> option specifies files that are not listed at all.<br>
<br>
More about all of this here: <a class="Identifier" href="cmdline.html#cmdline-completion">cmdline-completion</a><br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_20.html#20.4" name="20.4">20.4</a> Command line history<br>
<br>
In chapter 3 we briefly mentioned the history. The basics are that you can<br>
use the <span class="Special"><Up></span> key to recall an older command line. <span class="Special"><Down></span> then takes you back<br>
to newer commands.<br>
<br>
There are actually four histories. The ones we will mention here are for ":"<br>
commands and for "/" and "?" search commands. The "/" and "?" commands share<br>
the same history, because they are both search commands. The two other<br>
histories are for expressions and input lines for the input() function.<br>
<a class="Identifier" href="cmdline.html#cmdline-history">cmdline-history</a><br>
<br>
Suppose you have done a ":set" command, typed ten more colon commands and then<br>
want to repeat that ":set" command again. You could press ":" and then ten<br>
times <span class="Special"><Up></span>. There is a quicker way:<br>
<br>
<div class="helpExample"> :se<Up></div>
<br>
Vim will now go back to the previous command that started with "se". You have<br>
a good chance that this is the ":set" command you were looking for. At least<br>
you should not have to press <span class="Special"><Up></span> very often (unless ":set" commands is all<br>
you have done).<br>
<br>
The <span class="Special"><Up></span> key will use the text typed so far and compare it with the lines in<br>
the history. Only matching lines will be used.<br>
If you do not find the line you were looking for, use <span class="Special"><Down></span> to go back to<br>
what you typed and correct that. Or use <span class="Special">CTRL-U</span> to start all over again.<br>
<br>
To see all the lines in the history:<br>
<br>
<div class="helpExample"> :history</div>
<br>
That's the history of ":" commands. The search history is displayed with this<br>
command:<br>
<br>
<div class="helpExample"> :history /</div>
<br>
<span class="Special">CTRL-P</span> will work like <span class="Special"><Up></span>, except that it doesn't matter what you already<br>
typed. Similarly for <span class="Special">CTRL-N</span> and <span class="Special"><Down></span>. <span class="Special">CTRL-P</span> stands for previous, <span class="Special">CTRL-N</span><br>
for next.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_20.html#20.5" name="20.5">20.5</a> Command line window<br>
<br>
Typing the text in the command line works different from typing text in Insert<br>
mode. It doesn't allow many commands to change the text. For most commands<br>
that's OK, but sometimes you have to type a complicated command. That's where<br>
the command line window is useful.<br>
<br>
Open the command line window with this command:<br>
<br>
<div class="helpExample"> q:</div>
<br>
Vim now opens a (small) window at the bottom. It contains the command line<br>
history, and an empty line at the end:<br>
<br>
+-------------------------------------+<br>
|other window |<br>
|~ |<br>
|file.txt=============================|<br>
|:e c |<br>
|:e config.h.in |<br>
|:set path=.,/usr/include,, |<br>
|:set iskeyword=@,48-57,_,192-255 |<br>
|:set is |<br>
|:q |<br>
|: |<br>
|command-line=========================|<br>
| |<br>
+-------------------------------------+<br>
<br>
You are now in Normal mode. You can use the "hjkl" keys to move around. For<br>
example, move up with "5k" to the ":e config.h.in" line. Type "$h" to go to<br>
the "i" of "in" and type "cwout". Now you have changed the line to:<br>
<br>
<span class="PreProc">:e config.h.out</span><br>
<br>
Now press <span class="Special"><Enter></span> and this command will be executed. The command line window<br>
will close.<br>
The <span class="Special"><Enter></span> command will execute the line under the cursor. It doesn't<br>
matter whether Vim is in Insert mode or in Normal mode.<br>
Changes in the command line window are lost. They do not result in the<br>
history to be changed. Except that the command you execute will be added to<br>
the end of the history, like with all executed commands.<br>
<br>
The command line window is very useful when you want to have overview of the<br>
history, lookup a similar command, change it a bit and execute it. A search<br>
command can be used to find something.<br>
In the previous example the "?config" search command could have been used<br>
to find the previous command that contains "config". It's a bit strange,<br>
because you are using a command line to search in the command line window.<br>
While typing that search command you can't open another command line window,<br>
there can be only one.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<br>
Next chapter: <a class="Identifier" href="usr_21.html">usr_21.txt</a> Go away and come back<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: -->
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。