1 Star 0 Fork 0

hilarryxu/vimdoc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
usr_02.html 60.43 KB
一键复制 编辑 原始数据 按行查看 历史
hilarryxu 提交于 2017-08-15 10:58 . Init repo
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>usr_02 - 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_02<br />
<a name="top"></a><h1>usr_02 - 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_02.html" name="usr_02.txt">usr_02.txt</a>&nbsp;&nbsp;&nbsp;&nbsp;For&nbsp;<span class="Identifier">Vim version 8.0.</span>&nbsp;&nbsp;Last change: 2017 Mar 14<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIM USER MANUAL - by Bram Moolenaar<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The first steps in Vim<br>
<br>
<br>
This chapter provides just enough information to edit a file with Vim.&nbsp;&nbsp;Not<br>
well or fast, but you can edit.&nbsp;&nbsp;Take some time to practice with these<br>
commands, they form the base for what follows.<br>
<br>
<a class="Identifier" href="usr_02.html#02.1">02.1</a>&nbsp;&nbsp;Running Vim for the First Time<br>
<a class="Identifier" href="usr_02.html#02.2">02.2</a>&nbsp;&nbsp;Inserting text<br>
<a class="Identifier" href="usr_02.html#02.3">02.3</a>&nbsp;&nbsp;Moving around<br>
<a class="Identifier" href="usr_02.html#02.4">02.4</a>&nbsp;&nbsp;Deleting characters<br>
<a class="Identifier" href="usr_02.html#02.5">02.5</a>&nbsp;&nbsp;Undo and Redo<br>
<a class="Identifier" href="usr_02.html#02.6">02.6</a>&nbsp;&nbsp;Other editing commands<br>
<a class="Identifier" href="usr_02.html#02.7">02.7</a>&nbsp;&nbsp;Getting out<br>
<a class="Identifier" href="usr_02.html#02.8">02.8</a>&nbsp;&nbsp;Finding help<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; Next chapter:&nbsp;<a class="Identifier" href="usr_03.html">usr_03.txt</a>&nbsp;&nbsp;Moving around<br>
&nbsp;Previous chapter:&nbsp;<a class="Identifier" href="usr_01.html">usr_01.txt</a>&nbsp;&nbsp;About the manuals<br>
Table of contents:&nbsp;<a class="Identifier" href="usr_toc.html">usr_toc.txt</a><br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_02.html#02.1" name="02.1">02.1</a>&nbsp;&nbsp;Running Vim for the First Time<br>
<br>
To start Vim, enter this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gvim file.txt</div>
<br>
In UNIX you can type this at any command prompt.&nbsp;&nbsp;If you are running Microsoft<br>
Windows, open an MS-DOS prompt window and enter the command.<br>
&nbsp;&nbsp; In either case, Vim starts editing a file called file.txt.&nbsp;&nbsp;Because this<br>
is a new file, you get a blank window. This is what your screen will look<br>
like:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&quot;file.txt&quot; [New file]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;('#&quot; is the cursor position.)<br>
<br>
The tilde (~) lines indicate lines not in the file.&nbsp;&nbsp;In other words, when Vim<br>
runs out of file to display, it displays tilde lines.&nbsp;&nbsp;At the bottom of the<br>
screen, a message line indicates the file is named file.txt and shows that you<br>
are creating a new file.&nbsp;&nbsp;The message information is temporary and other<br>
information overwrites it.<br>
<br>
<br>
THE VIM COMMAND<br>
<br>
The gvim command causes the editor to create a new window for editing.&nbsp;&nbsp;If you<br>
use this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vim file.txt</div>
<br>
the editing occurs inside your command window.&nbsp;&nbsp;In other words, if you are<br>
running inside an xterm, the editor uses your xterm window.&nbsp;&nbsp;If you are using<br>
an MS-DOS command prompt window under Microsoft Windows, the editing occurs<br>
inside this window.&nbsp;&nbsp;The text in the window will look the same for both<br>
versions, but with gvim you have extra features, like a menu bar.&nbsp;&nbsp;More about<br>
that later.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_02.html#02.2" name="02.2">02.2</a>&nbsp;&nbsp;Inserting text<br>
<br>
The Vim editor is a modal editor.&nbsp;&nbsp;That means that the editor behaves<br>
differently, depending on which mode you are in.&nbsp;&nbsp;The two basic modes are<br>
called Normal mode and Insert mode.&nbsp;&nbsp;In Normal mode the characters you type<br>
are commands.&nbsp;&nbsp;In Insert mode the characters are inserted as text.<br>
&nbsp;&nbsp; Since you have just started Vim it will be in Normal mode.&nbsp;&nbsp;To start Insert<br>
mode you type the &quot;i&quot; command (i for Insert).&nbsp;&nbsp;Then you can enter<br>
the text.&nbsp;&nbsp;It will be inserted into the file.&nbsp;&nbsp;Do not worry if you make<br>
mistakes; you can correct them later.&nbsp;&nbsp;To enter the following programmer's<br>
limerick, this is what you type:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iA very intelligent turtle<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Found programming UNIX a hurdle</div>
<br>
After typing &quot;turtle&quot; you press the&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;key to start a new line.&nbsp;&nbsp;Finally<br>
you press the&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;key to stop Insert mode and go back to Normal mode.&nbsp;&nbsp;You<br>
now have two lines of text in your Vim window:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|A very intelligent turtle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Found programming UNIX a hurdle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
<br>
<br>
WHAT IS THE MODE?<br>
<br>
To be able to see what mode you are in, type this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set showmode</div>
<br>
You will notice that when typing the colon Vim moves the cursor to the last<br>
line of the window.&nbsp;&nbsp;That's where you type colon commands (commands that start<br>
with a colon).&nbsp;&nbsp;Finish this command by pressing the&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;key (all commands<br>
that start with a colon are finished this way).<br>
&nbsp;&nbsp; Now, if you type the &quot;i&quot; command Vim will display --INSERT-- at the bottom<br>
of the window.&nbsp;&nbsp;This indicates you are in Insert mode.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|A very intelligent turtle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Found programming UNIX a hurdle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-- INSERT --&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
<br>
If you press&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;to go back to Normal mode the last line will be made blank.<br>
<br>
<br>
GETTING OUT OF TROUBLE<br>
<br>
One of the problems for Vim novices is mode confusion, which is caused by<br>
forgetting which mode you are in or by accidentally typing a command that<br>
switches modes.&nbsp;&nbsp;To get back to Normal mode, no matter what mode you are in,<br>
press the&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;key.&nbsp;&nbsp;Sometimes you have to press it twice.&nbsp;&nbsp;If Vim beeps back<br>
at you, you already are in Normal mode.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_02.html#02.3" name="02.3">02.3</a>&nbsp;&nbsp;Moving around<br>
<br>
After you return to Normal mode, you can move around by using these keys:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h&nbsp;&nbsp; left&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_02.html#hjkl" name="hjkl">hjkl</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j&nbsp;&nbsp; down<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;k&nbsp;&nbsp; up<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l&nbsp;&nbsp; right<br>
<br>
At first, it may appear that these commands were chosen at random.&nbsp;&nbsp;After all,<br>
who ever heard of using l for right?&nbsp;&nbsp;But actually, there is a very good<br>
reason for these choices: Moving the cursor is the most common thing you do in<br>
an editor, and these keys are on the home row of your right hand.&nbsp;&nbsp;In other<br>
words, these commands are placed where you can type them the fastest<br>
(especially when you type with ten fingers).<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Todo">Note</span>:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You can also move the cursor by using the arrow keys.&nbsp;&nbsp;If you do,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;however, you greatly slow down your editing because to press the arrow<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keys, you must move your hand from the text keys to the arrow keys.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Considering that you might be doing it hundreds of times an hour, this<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;can take a significant amount of time.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Also, there are keyboards which do not have arrow keys, or which<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;locate them in unusual places; therefore, knowing the use of the hjkl<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keys helps in those situations.<br>
<br>
One way to remember these commands is that h is on the left, l is on the<br>
right and j points down.&nbsp;&nbsp;In a picture:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; h&nbsp;&nbsp;&nbsp;&nbsp; l<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j</div>
<br>
The best way to learn these commands is by using them.&nbsp;&nbsp;Use the &quot;i&quot; command to<br>
insert some more lines of text.&nbsp;&nbsp;Then use the hjkl keys to move around and<br>
insert a word somewhere.&nbsp;&nbsp;Don't forget to press&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;to go back to Normal<br>
mode.&nbsp;&nbsp;The&nbsp;<a class="Identifier" href="usr_01.html#vimtutor">vimtutor</a>&nbsp;is also a nice way to learn by doing.<br>
<br>
For Japanese users, Hiroshi Iwatani suggested using this:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Komsomolsk<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Huan Ho&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;--- ---&gt;&nbsp;&nbsp;Los Angeles<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Yellow river)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Java (the island, not the programming language)<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_02.html#02.4" name="02.4">02.4</a>&nbsp;&nbsp;Deleting characters<br>
<br>
To delete a character, move the cursor over it and type &quot;x&quot;.&nbsp;&nbsp;(This is a<br>
throwback to the old days of the typewriter, when you deleted things by typing<br>
xxxx over them.)&nbsp;&nbsp;Move the cursor to the beginning of the first line, for<br>
example, and type xxxxxxx (seven x's) to delete &quot;A very &quot;.&nbsp;&nbsp;The result should<br>
look like this:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|intelligent turtle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Found programming UNIX a hurdle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
<br>
Now you can insert new text, for example by typing:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iA young &lt;Esc&gt;</div>
<br>
This begins an insert (the i), inserts the words &quot;A young&quot;, and then exits<br>
insert mode (the final&nbsp;<span class="Special">&lt;Esc&gt;</span>).&nbsp;&nbsp;The result:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|A young intelligent turtle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Found programming UNIX a hurdle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
<br>
<br>
DELETING A LINE<br>
<br>
To delete a whole line use the &quot;dd&quot; command.&nbsp;&nbsp;The following line will<br>
then move up to fill the gap:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Found programming UNIX a hurdle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+---------------------------------------+<br>
<br>
<br>
DELETING A LINE BREAK<br>
<br>
In Vim you can join two lines together, which means that the line break<br>
between them is deleted.&nbsp;&nbsp;The &quot;J&quot; command does this.<br>
&nbsp;&nbsp; Take these two lines:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A young intelligent</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">turtle</span><br>
<br>
Move the cursor to the first line and press &quot;J&quot;:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A young intelligent turtle</span><br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_02.html#02.5" name="02.5">02.5</a>&nbsp;&nbsp;Undo and Redo<br>
<br>
Suppose you delete too much.&nbsp;&nbsp;Well, you can type it in again, but an easier<br>
way exists.&nbsp;&nbsp;The &quot;u&quot; command undoes the last edit.&nbsp;&nbsp;Take a look at this in<br>
action: After using &quot;dd&quot; to delete the first line, &quot;u&quot; brings it back.<br>
&nbsp;&nbsp; Another one: Move the cursor to the A in the first line:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A young intelligent turtle</span><br>
<br>
Now type xxxxxxx to delete &quot;A young&quot;.&nbsp;&nbsp;The result is as follows:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">intelligent turtle</span><br>
<br>
Type &quot;u&quot; to undo the last delete.&nbsp;&nbsp;That delete removed the g, so the undo<br>
restores the character.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">g intelligent turtle</span><br>
<br>
The next u command restores the next-to-last character deleted:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">ng intelligent turtle</span><br>
<br>
The next u command gives you the u, and so on:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">ung intelligent turtle</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">oung intelligent turtle</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">young intelligent turtle</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">young intelligent turtle</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A young intelligent turtle</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Todo">Note</span>:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If you type &quot;u&quot; twice, and the result is that you get the same text<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;back, you have Vim configured to work Vi compatible.&nbsp;&nbsp;Look here to fix<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this:&nbsp;<a class="Identifier" href="usr_01.html#not-compatible">not-compatible</a>.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This text assumes you work &quot;The Vim Way&quot;.&nbsp;&nbsp;You might prefer to use<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the good old Vi way, but you will have to watch out for small<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;differences in the text then.<br>
<br>
<br>
REDO<br>
<br>
If you undo too many times, you can press&nbsp;<span class="Special">CTRL-R</span>&nbsp;(redo) to reverse the<br>
preceding command.&nbsp;&nbsp;In other words, it undoes the undo.&nbsp;&nbsp;To see this in<br>
action, press&nbsp;<span class="Special">CTRL-R</span>&nbsp;twice.&nbsp;&nbsp;The character A and the space after it disappear:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">young intelligent turtle</span><br>
<br>
There's a special version of the undo command, the &quot;U&quot; (undo line) command.<br>
The undo line command undoes all the changes made on the last line that was<br>
edited.&nbsp;&nbsp;Typing this command twice cancels the preceding &quot;U&quot;.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A very intelligent turtle</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xxxx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delete very<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A intelligent turtle</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xxxxxx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delete turtle<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A intelligent</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Restore line with &quot;U&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A very intelligent turtle</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Undo &quot;U&quot; with &quot;u&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A intelligent</span><br>
<br>
The &quot;U&quot; command is a change by itself, which the &quot;u&quot; command undoes and&nbsp;<span class="Special">CTRL-R</span><br>
redoes.&nbsp;&nbsp;This might be a bit confusing.&nbsp;&nbsp;Don't worry, with &quot;u&quot; and&nbsp;<span class="Special">CTRL-R</span>&nbsp;you<br>
can go to any of the situations you had.&nbsp;&nbsp;More about that in section&nbsp;<a class="Identifier" href="usr_32.html#32.2">32.2</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_02.html#02.6" name="02.6">02.6</a>&nbsp;&nbsp;Other editing commands<br>
<br>
Vim has a large number of commands to change the text.&nbsp;&nbsp;See&nbsp;<a class="Identifier" href="quickref.html#Q_in">Q_in</a>&nbsp;and below.<br>
Here are a few often used ones.<br>
<br>
<br>
APPENDING<br>
<br>
The &quot;i&quot; command inserts a character before the character under the cursor.<br>
That works fine; but what happens if you want to add stuff to the end of the<br>
line?&nbsp;&nbsp;For that you need to insert text after the cursor.&nbsp;&nbsp;This is done with<br>
the &quot;a&quot; (append) command.<br>
&nbsp;&nbsp; For example, to change the line<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">and that's not saying much for the turtle.</span><br>
to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">and that's not saying much for the turtle!!!</span><br>
<br>
move the cursor over to the dot at the end of the line. Then type &quot;x&quot; to<br>
delete the period.&nbsp;&nbsp;The cursor is now positioned at the end of the line on the<br>
e in turtle.&nbsp;&nbsp;Now type<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a!!!&lt;Esc&gt;</div>
<br>
to append three exclamation points after the e in turtle:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">and that's not saying much for the turtle!!!</span><br>
<br>
<br>
OPENING UP A NEW LINE<br>
<br>
The &quot;o&quot; command creates a new, empty line below the cursor and puts Vim in<br>
Insert mode.&nbsp;&nbsp;Then you can type the text for the new line.<br>
&nbsp;&nbsp; Suppose the cursor is somewhere in the first of these two lines:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A very intelligent turtle</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">Found programming UNIX a hurdle</span><br>
<br>
If you now use the &quot;o&quot; command and type new text:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oThat liked using Vim&lt;Esc&gt;</div>
<br>
The result is:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">A very intelligent turtle</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">That liked using Vim</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">Found programming UNIX a hurdle</span><br>
<br>
The &quot;O&quot; command (uppercase) opens a line above the cursor.<br>
<br>
<br>
USING A COUNT<br>
<br>
Suppose you want to move up nine lines.&nbsp;&nbsp;You can type &quot;kkkkkkkkk&quot; or you can<br>
enter the command &quot;9k&quot;.&nbsp;&nbsp;In fact, you can precede many commands with a number.<br>
Earlier in this chapter, for instance, you added three exclamation points to<br>
the end of a line by typing &quot;a!!!<span class="Special">&lt;Esc&gt;</span>&quot;.&nbsp;&nbsp;Another way to do this is to use the<br>
command &quot;3a!<span class="Special">&lt;Esc&gt;</span>&quot;.&nbsp;&nbsp;The count of 3 tells the command that follows to triple<br>
its effect.&nbsp;&nbsp;Similarly, to delete three characters, use the command &quot;3x&quot;.&nbsp;&nbsp;The<br>
count always comes before the command it applies to.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_02.html#02.7" name="02.7">02.7</a>&nbsp;&nbsp;Getting out<br>
<br>
To exit, use the &quot;ZZ&quot; command.&nbsp;&nbsp;This command writes the file and exits.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Todo">Note</span>:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unlike many other editors, Vim does not automatically make a backup<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file.&nbsp;&nbsp;If you type &quot;ZZ&quot;, your changes are committed and there's no<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;turning back.&nbsp;&nbsp;You can configure the Vim editor to produce backup<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;files, see&nbsp;<a class="Identifier" href="usr_07.html#07.4">07.4</a>.<br>
<br>
<br>
DISCARDING CHANGES<br>
<br>
Sometimes you will make a sequence of changes and suddenly realize you were<br>
better off before you started.&nbsp;&nbsp;Not to worry; Vim has a<br>
quit-and-throw-things-away command.&nbsp;&nbsp;It is:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:q!</div>
<br>
Don't forget to press&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;to finish the command.<br>
<br>
For those of you interested in the details, the three parts of this command<br>
are the colon (:), which enters Command-line mode; the q command, which tells<br>
the editor to quit; and the override command modifier (!).<br>
&nbsp;&nbsp; The override command modifier is needed because Vim is reluctant to throw<br>
away changes.&nbsp;&nbsp;If you were to just type &quot;:q&quot;, Vim would display an error<br>
message and refuse to exit:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">E37: No write since last change (use ! to override)</span><br>
<br>
By specifying the override, you are in effect telling Vim, &quot;I know that what<br>
I'm doing looks stupid, but I'm a big boy and really want to do this.&quot;<br>
<br>
If you want to continue editing with Vim&#0058; The &quot;:e!&quot; command reloads the<br>
original version of the file.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_02.html#02.8" name="02.8">02.8</a>&nbsp;&nbsp;Finding help<br>
<br>
Everything you always wanted to know can be found in the Vim help files.<br>
Don't be afraid to ask!<br>
<br>
If you know what you are looking for, it is usually easier to search for it<br>
using the help system, instead of using Google.&nbsp;&nbsp;Because the subjects follow<br>
a certain style guide.<br>
<br>
Also the help has the advantage of belonging to your particular Vim version.<br>
You won't see help for commands added later.&nbsp;&nbsp;These would not work for you.<br>
<br>
To get generic help use this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help</div>
<br>
You could also use the first function key&nbsp;<span class="Special">&lt;F1&gt;</span>.&nbsp;&nbsp;If your keyboard has a&nbsp;<span class="Special">&lt;Help&gt;</span><br>
key it might work as well.<br>
&nbsp;&nbsp; If you don't supply a subject, &quot;:help&quot; displays the general help window.<br>
The creators of Vim did something very clever (or very lazy) with the help<br>
system: They made the help window a normal editing window.&nbsp;&nbsp;You can use all<br>
the normal Vim commands to move through the help information.&nbsp;&nbsp;Therefore h, j,<br>
k, and l move left, down, up and right.<br>
&nbsp;&nbsp; To get out of the help window, use the same command you use to get out of<br>
the editor: &quot;ZZ&quot;.&nbsp;&nbsp;This will only close the help window, not exit Vim.<br>
<br>
As you read the help text, you will notice some text enclosed in vertical bars<br>
(for example,&nbsp;<a class="Identifier" href="helphelp.html#help">help</a>).&nbsp;&nbsp;This indicates a hyperlink.&nbsp;&nbsp;If you position the<br>
cursor anywhere between the bars and press&nbsp;<span class="Special">CTRL-]</span>&nbsp;(jump to tag), the help<br>
system takes you to the indicated subject.&nbsp;&nbsp;(For reasons not discussed here,<br>
the Vim terminology for a hyperlink is tag.&nbsp;&nbsp;So&nbsp;<span class="Special">CTRL-]</span>&nbsp;jumps to the location<br>
of the tag given by the word under the cursor.)<br>
&nbsp;&nbsp; After a few jumps, you might want to go back.&nbsp;&nbsp;<span class="Special">CTRL-T</span>&nbsp;(pop tag) takes you<br>
back to the preceding position.&nbsp;&nbsp;<span class="Special">CTRL-O</span>&nbsp;(jump to older position) also works<br>
nicely here.<br>
&nbsp;&nbsp; At the top of the help screen, there is the notation *help.txt*.&nbsp;&nbsp;This name<br>
between &quot;*&quot; characters is used by the help system to define a tag (hyperlink<br>
destination).<br>
&nbsp;&nbsp; See&nbsp;<a class="Identifier" href="usr_29.html#29.1">29.1</a>&nbsp;for details about using tags.<br>
<br>
To get help on a given subject, use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help {subject}</div>
<br>
To get help on the &quot;x&quot; command, for example, enter the following:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help x</div>
<br>
To find out how to delete text, use this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help deleting</div>
<br>
To get a complete index of all Vim commands, use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help index</div>
<br>
When you need to get help for a control character command (for example,<br>
<span class="Special">CTRL-A</span>), you need to spell it with the prefix &quot;<span class="Special">CTRL-&quot;</span>.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help CTRL-A</div>
<br>
The Vim editor has many different modes.&nbsp;&nbsp;By default, the help system displays<br>
the normal-mode commands.&nbsp;&nbsp;For example, the following command displays help<br>
for the normal-mode&nbsp;<span class="Special">CTRL-H</span>&nbsp;command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help CTRL-H</div>
<br>
To identify other modes, use a mode prefix.&nbsp;&nbsp;If you want the help for the<br>
insert-mode version of a command, use &quot;i_&quot;.&nbsp;&nbsp;For&nbsp;<span class="Special">CTRL-H</span>&nbsp;this gives you the<br>
following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help i_CTRL-H</div>
<br>
When you start the Vim editor, you can use several command-line arguments.<br>
These all begin with a dash (-).&nbsp;&nbsp;To find what the -t argument does, for<br>
example, use the command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help -t</div>
<br>
The Vim editor has a number of options that enable you to configure and<br>
customize the editor.&nbsp;&nbsp;If you want help for an option, you need to enclose it<br>
in single quotation marks.&nbsp;&nbsp;To find out what the&nbsp;<a class="Type" href="options.html#'number'">'number'</a>&nbsp;option does, for<br>
example, use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help 'number'</div>
<br>
The table with all mode prefixes can be found below:&nbsp;<a class="Identifier" href="usr_02.html#help-summary">help-summary</a>.<br>
<br>
Special keys are enclosed in angle brackets.&nbsp;&nbsp;To find help on the up-arrow key<br>
in Insert mode, for instance, use this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help i_&lt;Up&gt;</div>
<br>
If you see an error message that you don't understand, for example:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">E37: No write since last change (use ! to override)</span><br>
<br>
You can use the error ID at the start to find help about it:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help E37</div>
<br>
<br>
Summary:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_02.html#help-summary" name="help-summary">help-summary</a>&nbsp;<br>
<br>
1) Use Ctrl-D after typing a topic and let Vim show all available topics.<br>
&nbsp;&nbsp; Or press Tab to complete:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help some&lt;Tab&gt;</div>
&nbsp;&nbsp;&nbsp; More information on how to use the help:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help helphelp</div>
<br>
2) Follow the links in bars to related help.&nbsp;&nbsp;You can go from the detailed<br>
&nbsp;&nbsp; help to the user documentation, which describes certain commands more from<br>
&nbsp;&nbsp; a user perspective and less detailed.&nbsp;&nbsp;E.g. after:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help pattern.txt</div>
&nbsp;&nbsp;&nbsp; You can see the user guide topics&nbsp;<a class="Identifier" href="usr_03.html#03.9">03.9</a>&nbsp;and&nbsp;<a class="Identifier" href="usr_27.html">usr_27.txt</a>&nbsp;in the<br>
&nbsp;&nbsp; introduction.<br>
<br>
3) Options are enclosed in single apostrophes.&nbsp;&nbsp;To go to the help topic for the<br>
&nbsp;&nbsp; list option:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help 'list'</div>
&nbsp;&nbsp;&nbsp; If you only know you are looking for a certain option, you can also do:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help options.txt</div>
&nbsp;&nbsp;&nbsp; to open the help page which describes all option handling and then search<br>
&nbsp;&nbsp; using regular expressions, e.g. textwidth.<br>
&nbsp;&nbsp; Certain options have their own namespace, e.g.:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help cpo-&lt;letter&gt;</div>
&nbsp;&nbsp;&nbsp; for the corresponding flag of the&nbsp;<a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>&nbsp;settings, substitute&nbsp;<span class="Special">&lt;letter&gt;</span><br>
&nbsp;&nbsp; by a specific flag, e.g.:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help cpo-;</div>
&nbsp;&nbsp;&nbsp; And for the guioption flags:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help go-&lt;letter&gt;</div>
<br>
4) Normal mode commands do not have a prefix. To go to the help page for the<br>
&nbsp;&nbsp; &quot;gt&quot; command:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help gt</div>
<br>
5) Insert mode commands start with i_.&nbsp;&nbsp;Help for deleting a word:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help i_CTRL-W</div>
<br>
6) Visual mode commands start with v_.&nbsp;&nbsp;Help for jumping to the other side of<br>
&nbsp;&nbsp; the Visual area:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help v_o</div>
<br>
7) Command line editing and arguments start with c_.&nbsp;&nbsp;Help for using the<br>
&nbsp;&nbsp; command argument %:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help c_%</div>
<br>
8) Ex-commands always start with &quot;:&quot;, so to go to the :s command help:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help :s</div>
<br>
9) Commands specifically for debugging start with &quot;&gt;&quot;.&nbsp;&nbsp;To go to the help<br>
&nbsp;&nbsp; for the &quot;cont&quot; debug command:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help &gt;cont</div>
<br>
10) Key combinations.&nbsp;&nbsp;They usually start with a single letter indicating<br>
&nbsp;&nbsp;&nbsp;&nbsp;the mode for which they can be used.&nbsp;&nbsp;E.g.:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help i_CTRL-X</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;takes you to the family of Ctrl-X commands for insert mode which can be<br>
&nbsp;&nbsp;&nbsp;&nbsp;used to auto complete different things.&nbsp;&nbsp;<span class="Todo">Note</span>, that certain keys will<br>
&nbsp;&nbsp;&nbsp;&nbsp;always be written the same, e.g. Control will always be CTRL.<br>
&nbsp;&nbsp;&nbsp;&nbsp;For normal mode commands there is no prefix and the topic is available at<br>
&nbsp;&nbsp;&nbsp;&nbsp;:h&nbsp;<span class="Special">CTRL-&lt;</span>Letter&gt;. E.g.&nbsp;<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help CTRL-W</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;In contrast<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help c_CTRL-R</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;will describe what the Ctrl-R does when entering commands in the Command<br>
&nbsp;&nbsp;&nbsp;&nbsp;line and<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help v_Ctrl-A</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;talks about incrementing numbers in visual mode and<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help g_CTRL-A</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;talks about the g<span class="Special">&lt;C-A&gt;</span>&nbsp;command (e.g. you have to press &quot;g&quot; then&nbsp;<span class="Special">&lt;Ctrl-A&gt;</span>).<br>
&nbsp;&nbsp;&nbsp;&nbsp;Here the &quot;g&quot; stand for the normal command &quot;g&quot; which always expects a second<br>
&nbsp;&nbsp;&nbsp;&nbsp;key before doing something similar to the commands starting with &quot;z&quot;<br>
<br>
11) Regexp items always start with /.&nbsp;&nbsp;So to get help for the &quot;\+&quot; quantifier<br>
&nbsp;&nbsp;&nbsp;&nbsp;in Vim regexes:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help /\+</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If you need to know everything about regular expressions, start reading<br>
&nbsp;&nbsp;&nbsp;&nbsp;at:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help pattern.txt</div>
<br>
12) Registers always start with &quot;quote&quot;. To find out about the special &quot;:&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;register:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help quote:</div>
<br>
13) Vim script is available at<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help eval.txt</div>
&nbsp;&nbsp;&nbsp; Certain aspects of the language are available at :h expr-X where &quot;X&quot; is a<br>
&nbsp;&nbsp; single letter. E.g.&nbsp;<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help expr-!</div>
&nbsp;&nbsp;&nbsp; will take you to the topic describing the &quot;!&quot; (Not) operator for<br>
&nbsp;&nbsp; VimScript.<br>
&nbsp;&nbsp; Also important is<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help function-list</div>
&nbsp;&nbsp;&nbsp; to find a short description of all functions available.&nbsp;&nbsp;Help topics for<br>
&nbsp;&nbsp; Vim script functions always include the &quot;()&quot;, so:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help append()</div>
&nbsp;&nbsp;&nbsp; talks about the append Vim script function rather than how to append text<br>
&nbsp;&nbsp; in the current buffer.<br>
<br>
14) Mappings are talked about in the help page :h&nbsp;<a class="Identifier" href="map.html">map.txt</a>. Use<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help mapmode-i</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to find out about the&nbsp;<a class="Identifier" href="map.html#:imap">:imap</a>&nbsp;command.&nbsp;&nbsp;Also use :map-topic<br>
&nbsp;&nbsp;&nbsp;&nbsp;to find out about certain subtopics particular for mappings.&nbsp;&nbsp;e.g:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help :map-local</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for buffer-local mappings or<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help map-bar</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for how the '|' is handled in mappings.<br>
<br>
15) Command definitions are talked about :h command-topic, so use<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help command-bar</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to find out about the '!' argument for custom commands.<br>
<br>
16) Window management commands always start with&nbsp;<span class="Special">CTRL-W</span>, so you find the<br>
&nbsp;&nbsp;&nbsp;&nbsp;corresponding help at :h&nbsp;<span class="Special">CTRL-W</span>_letter.&nbsp;&nbsp;E.g.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help CTRL-W_p</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for moving the previous accessed window.&nbsp;&nbsp;You can also access<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help windows.txt</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and read your way through if you are looking for window handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;commands.<br>
<br>
17) Use&nbsp;<a class="Identifier" href="helphelp.html#:helpgrep">:helpgrep</a>&nbsp;to search in all help pages (and also of any installed<br>
&nbsp;&nbsp;&nbsp;&nbsp;plugins).&nbsp;&nbsp;See&nbsp;<a class="Identifier" href="helphelp.html#:helpgrep">:helpgrep</a>&nbsp;for how to use it.<br>
&nbsp;&nbsp;&nbsp;&nbsp;To search for a topic:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:helpgrep topic</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This takes you to the first match.&nbsp;&nbsp;To go to the next one:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:cnext</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;All matches are available in the quickfix window which can be opened<br>
&nbsp;&nbsp;&nbsp;&nbsp;with:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:copen</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Move around to the match you like and press Enter to jump to that help.<br>
<br>
18) The user manual.&nbsp;&nbsp;This describes help topics for beginners in a rather<br>
&nbsp;&nbsp;&nbsp;&nbsp;friendly way.&nbsp;&nbsp;Start at&nbsp;<a class="Identifier" href="usr_toc.html">usr_toc.txt</a>&nbsp;to find the table of content (as you<br>
&nbsp;&nbsp;&nbsp;&nbsp;might have guessed):<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help usr_toc.txt</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Skim over the contents to find interesting topics. The &quot;Digraphs&quot; and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&quot;Entering special characters&quot; items are in chapter 24, so to go to that<br>
&nbsp;&nbsp;&nbsp;&nbsp;particular help page:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help usr_24.txt</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Also if you want to access a certain chapter in the help, the chapter<br>
&nbsp;&nbsp;&nbsp;&nbsp;number can be accessed directly like this:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help 10.1</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goes to chapter 10.1 in&nbsp;<a class="Identifier" href="usr_10.html">usr_10.txt</a>&nbsp;and talks about recording macros.<br>
<br>
19) Highlighting groups.&nbsp;&nbsp;Always start with hl-groupname.&nbsp;&nbsp;E.g.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help hl-WarningMsg</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;talks about the WarningMsg highlighting group.<br>
<br>
20) Syntax highlighting is namespaced to :syn-topic e.g.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help :syn-conceal</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;talks about the conceal argument for the :syn command.<br>
<br>
21) Quickfix commands usually start with :c while location list commands<br>
&nbsp;&nbsp;&nbsp;&nbsp;usually start with :l<br>
<br>
22) Autocommand events can be found by their name:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help BufWinLeave</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;To see all possible events:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help autocommand-events</div>
<br>
23) Command-line switches always start with &quot;-&quot;.&nbsp;&nbsp;So for the help of the -f<br>
&nbsp;&nbsp;&nbsp;&nbsp;command switch of Vim use:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help -f</div>
<br>
24) Optional features always start with &quot;+&quot;.&nbsp;&nbsp;To find out about the<br>
&nbsp;&nbsp;&nbsp;&nbsp;conceal feature use:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help +conceal</div>
<br>
25) Documentation for included filetype specific functionality is usually<br>
&nbsp;&nbsp;&nbsp;&nbsp;available&nbsp;&nbsp;in the form ft-<span class="Special">&lt;filetype&gt;</span>-<span class="Special">&lt;functionality&gt;</span>.&nbsp;&nbsp;So<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help ft-c-syntax</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;talks about the C syntax file and the option it provides.&nbsp;&nbsp;Sometimes,<br>
&nbsp;&nbsp;&nbsp;&nbsp;additional sections for omni completion<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help ft-php-omni</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or filetype plugins<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help ft-tex-plugin</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;are available.<br>
<br>
26) Error and Warning codes can be looked up directly in the help.&nbsp;&nbsp;So<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help E297</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;takes you exactly to the description of the swap error message and<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help W10</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;talks about the warning &quot;Changing a readonly file&quot;.<br>
&nbsp;&nbsp;&nbsp;&nbsp;Sometimes however, those error codes are not described, but rather are<br>
&nbsp;&nbsp;&nbsp;&nbsp;listed at the Vim command that usually causes this.&nbsp;&nbsp;So:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help E128</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;takes you to the&nbsp;<a class="Identifier" href="eval.html#:function">:function</a>&nbsp;command<br>
<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<br>
Next chapter:&nbsp;<a class="Identifier" href="usr_03.html">usr_03.txt</a>&nbsp;&nbsp;Moving around<br>
<br>
Copyright: see&nbsp;<a class="Identifier" href="usr_01.html#manual-copyright">manual-copyright</a>&nbsp;&nbsp;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: -->
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hilarryxu/vimdoc.git
git@gitee.com:hilarryxu/vimdoc.git
hilarryxu
vimdoc
vimdoc
master

搜索帮助