代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>intro - 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>
/ intro<br />
<a name="top"></a><h1>intro - 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="intro.html" name="intro.txt">intro.txt</a> For <span class="Identifier">Vim version 8.0.</span> Last change: 2017 Jul 30<br>
<br>
<br>
<span class="Identifier">VIM REFERENCE MANUAL by Bram Moolenaar</span><br>
<br>
<br>
Introduction to Vim <a class="Constant" href="intro.html#ref" name="ref">ref</a> <a class="Constant" href="intro.html#reference" name="reference">reference</a><br>
<br>
1. Introduction <a class="Identifier" href="intro.html#intro">intro</a><br>
2. Vim on the internet <a class="Identifier" href="intro.html#internet">internet</a><br>
3. Credits <a class="Identifier" href="intro.html#credits">credits</a><br>
4. Notation <a class="Identifier" href="intro.html#notation">notation</a><br>
5. Modes, introduction <a class="Identifier" href="intro.html#vim-modes-intro">vim-modes-intro</a><br>
6. Switching from mode to mode <a class="Identifier" href="intro.html#mode-switching">mode-switching</a><br>
7. The window contents <a class="Identifier" href="intro.html#window-contents">window-contents</a><br>
8. Definitions <a class="Identifier" href="intro.html#definitions">definitions</a><br>
<br>
<span class="PreProc">==============================================================================</span><br>
1. Introduction <a class="Constant" href="intro.html#intro" name="intro">intro</a><br>
<br>
Vim stands for Vi IMproved. It used to be Vi IMitation, but there are so many<br>
improvements that a name change was appropriate. Vim is a text editor which<br>
includes almost all the commands from the Unix program "Vi" and a lot of new<br>
ones. It is very useful for editing programs and other plain text.<br>
All commands are given with the keyboard. This has the advantage that you<br>
can keep your fingers on the keyboard and your eyes on the screen. For those<br>
who want it, there is mouse support and a GUI version with scrollbars and<br>
menus (see <a class="Identifier" href="gui.html">gui.txt</a>).<br>
<br>
An overview of this manual can be found in the file "help.txt", <a class="Identifier" href="index.html">help.txt</a>.<br>
It can be accessed from within Vim with the <span class="Special"><Help></span> or <span class="Special"><F1></span> key and with the<br>
<a class="Identifier" href="helphelp.html#:help">:help</a> command (just type ":help", without the bars or quotes).<br>
The <a class="Type" href="options.html#'helpfile'">'helpfile'</a> option can be set to the name of the help file, in case it<br>
is not located in the default place. You can jump to subjects like with tags:<br>
Use <span class="Special">CTRL-]</span> to jump to a subject under the cursor, use <span class="Special">CTRL-T</span> to jump back.<br>
<br>
Throughout this manual the differences between Vi and Vim are mentioned in<br>
curly braces, like this: <span class="Special">{Vi does not have on-line help}</span>. See <a class="Identifier" href="vi_diff.html">vi_diff.txt</a><br>
for a summary of the differences between Vim and Vi.<br>
<br>
This manual refers to Vim on various machines. There may be small differences<br>
between different computers and terminals. Besides the remarks given in this<br>
document, there is a separate document for each supported system, see<br>
<a class="Identifier" href="index.html#sys-file-list">sys-file-list</a>.<br>
<br>
<a class="Constant" href="intro.html#pronounce" name="pronounce">pronounce</a><br>
Vim is pronounced as one word, like Jim, not vi-ai-em. It's written with a<br>
capital, since it's a name, again like Jim.<br>
<br>
This manual is a reference for all the Vim commands and options. This is not<br>
an introduction to the use of Vi or Vim, it gets a bit complicated here and<br>
there. For beginners, there is a hands-on <a class="Identifier" href="usr_01.html#tutor">tutor</a>. To learn using Vim, read<br>
the user manual <a class="Identifier" href="usr_toc.html">usr_toc.txt</a>.<br>
<br>
<a class="Constant" href="intro.html#book" name="book">book</a><br>
There are many books on Vi that contain a section for beginners. There are<br>
two books I can recommend:<br>
<br>
"Vim - Vi Improved" by Steve Oualline<br>
<br>
This is the very first book completely dedicated to Vim. It is very good for<br>
beginners. The most often used commands are explained with pictures and<br>
examples. The less often used commands are also explained, the more advanced<br>
features are summarized. There is a comprehensive index and a quick<br>
reference. Parts of this book have been included in the user manual<br>
<a class="Identifier" href="usr_01.html#frombook">frombook</a>.<br>
Published by New Riders Publishing. ISBN: 0735710015<br>
For more information try one of these:<br>
<span class="Constant"><a href="http://iccf-holland.org/click5.html">http://iccf-holland.org/click5.html</a></span><br>
<span class="Constant"><a href="http://www.vim.org/iccf/click5.html">http://www.vim.org/iccf/click5.html</a></span><br>
<br>
"Learning the Vi editor" by Linda Lamb and Arnold Robbins<br>
<br>
This is a book about Vi that includes a chapter on Vim (in the sixth edition).<br>
The first steps in Vi are explained very well. The commands that Vim adds are<br>
only briefly mentioned. There is also a German translation.<br>
Published by O'Reilly. ISBN: 1-56592-426-6.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
2. Vim on the internet <a class="Constant" href="intro.html#internet" name="internet">internet</a><br>
<br>
<a class="Constant" href="intro.html#www" name="www">www</a> <a class="Constant" href="intro.html#WWW" name="WWW">WWW</a> <a class="Constant" href="intro.html#faq" name="faq">faq</a> <a class="Constant" href="intro.html#FAQ" name="FAQ">FAQ</a> <a class="Constant" href="intro.html#distribution" name="distribution">distribution</a> <a class="Constant" href="intro.html#download" name="download">download</a><br>
The Vim pages contain the most recent information about Vim. They also<br>
contain links to the most recent version of Vim. The FAQ is a list of<br>
Frequently Asked Questions. Read this if you have problems.<br>
<br>
Vim home page: <span class="Constant"><a href="http://www.vim.org/">http://www.vim.org/</a></span><br>
Vim FAQ: <span class="Constant"><a href="http://vimdoc.sf.net/">http://vimdoc.sf.net/</a></span><br>
Downloading: <span class="Constant">ftp://ftp.vim.org/pub/vim/MIRRORS</span><br>
<br>
<br>
Usenet News group where Vim is discussed: <a class="Constant" href="intro.html#news" name="news">news</a> <a class="Constant" href="intro.html#usenet" name="usenet">usenet</a><br>
comp.editors<br>
This group is also for other editors. If you write about Vim, don't forget to<br>
mention that.<br>
<br>
<a class="Constant" href="intro.html#mail-list" name="mail-list">mail-list</a> <a class="Constant" href="intro.html#maillist" name="maillist">maillist</a><br>
There are several mailing lists for Vim:<br>
<vim@vim.org> <a class="Constant" href="intro.html#vim-use" name="vim-use">vim-use</a> <a class="Constant" href="intro.html#vim_use" name="vim_use">vim_use</a><br>
For discussions about using existing versions of Vim: Useful mappings,<br>
questions, answers, where to get a specific version, etc. There are<br>
quite a few people watching this list and answering questions, also<br>
for beginners. Don't hesitate to ask your question here.<br>
<vim-dev@vim.org> <a class="Constant" href="intro.html#vim-dev" name="vim-dev">vim-dev</a> <a class="Constant" href="intro.html#vim_dev" name="vim_dev">vim_dev</a> <a class="Constant" href="intro.html#vimdev" name="vimdev">vimdev</a><br>
For discussions about changing Vim: New features, porting, patches,<br>
beta-test versions, etc.<br>
<vim-announce@vim.org> <a class="Constant" href="intro.html#vim-announce" name="vim-announce">vim-announce</a> <a class="Constant" href="intro.html#vim_announce" name="vim_announce">vim_announce</a><br>
Announcements about new versions of Vim; also for beta-test versions<br>
and ports to different systems. This is a read-only list.<br>
<vim-mac@vim.org> <a class="Constant" href="intro.html#vim-mac" name="vim-mac">vim-mac</a> <a class="Constant" href="intro.html#vim_mac" name="vim_mac">vim_mac</a><br>
For discussions about using and improving the Macintosh version of<br>
Vim.<br>
<br>
See <span class="Constant"><a href="http://www.vim.org/maillist.php">http://www.vim.org/maillist.php</a></span> for the latest information.<br>
<br>
<span class="Todo">NOTE</span>:<br>
- You can only send messages to these lists if you have subscribed!<br>
- You need to send the messages from the same location as where you subscribed<br>
from (to avoid spam mail).<br>
- Maximum message size is 40000 characters.<br>
<br>
<a class="Constant" href="intro.html#subscribe-maillist" name="subscribe-maillist">subscribe-maillist</a><br>
If you want to join, send a message to<br>
<vim-subscribe@vim.org><br>
Make sure that your "From:" address is correct. Then the list server will<br>
give you help on how to subscribe.<br>
<br>
<a class="Constant" href="intro.html#maillist-archive" name="maillist-archive">maillist-archive</a><br>
For more information and archives look on the Vim maillist page:<br>
<span class="Constant"><a href="http://www.vim.org/maillist.php">http://www.vim.org/maillist.php</a></span><br>
<br>
<br>
Bug reports: <a class="Constant" href="intro.html#bugs" name="bugs">bugs</a> <a class="Constant" href="intro.html#bug-reports" name="bug-reports">bug-reports</a> <a class="Constant" href="intro.html#bugreport.vim" name="bugreport.vim">bugreport.vim</a><br>
<br>
There are two ways to report bugs, both work:<br>
1. Send bug reports to: Vim Developers <vim-dev@vim.org><br>
This is a maillist, you need to become a member first and many people will<br>
see the message. If you don't want that, e.g. because it is a security<br>
issue, send it to <bugs@vim.org>, this only goes to the Vim maintainer<br>
(that's Bram).<br>
2. Open issue on GitHub: <span class="Constant"><a href="https://github.com/vim/vim/issues">https://github.com/vim/vim/issues</a></span><br>
The text will be forwarded to the vim-dev maillist.<br>
<br>
Please be brief; all the time that is spent on answering mail is subtracted<br>
from the time that is spent on improving Vim! Always give a reproducible<br>
example and try to find out which settings or other things trigger the bug.<br>
<br>
Preferably start Vim with:<br>
<div class="helpExample"> vim --clean -u reproduce.vim</div>
Where reproduce.vim is a script that reproduces the problem. Try different<br>
machines, if relevant (is this an MS-Windows specific bug perhaps?).<br>
<br>
Send me patches if you can!<br>
<br>
It will help to include information about the version of Vim you are using and<br>
your setup. You can get the information with this command:<br>
<div class="helpExample"> :so $VIMRUNTIME/bugreport.vim</div>
This will create a file "bugreport.txt" in the current directory, with a lot<br>
of information of your environment. Before sending this out, check if it<br>
doesn't contain any confidential information!<br>
<br>
If Vim crashes, please try to find out where. You can find help on this here:<br>
<a class="Identifier" href="debug.html">debug.txt</a>.<br>
<br>
In case of doubt or when you wonder if the problem has already been fixed but<br>
you can't find a fix for it, become a member of the vim-dev maillist and ask<br>
your question there. <a class="Identifier" href="intro.html#maillist">maillist</a><br>
<br>
<a class="Constant" href="intro.html#year-2000" name="year-2000">year-2000</a> <a class="Constant" href="intro.html#Y2K" name="Y2K">Y2K</a><br>
Since Vim internally doesn't use dates for editing, there is no year 2000<br>
problem to worry about. Vim does use the time in the form of seconds since<br>
January 1st 1970. It is used for a time-stamp check of the edited file and<br>
the swap file, which is not critical and should only cause warning messages.<br>
<br>
There might be a year 2038 problem, when the seconds don't fit in a 32 bit int<br>
anymore. This depends on the compiler, libraries and operating system.<br>
Specifically, time_t and the ctime() function are used. And the time_t is<br>
stored in four bytes in the swap file. But that's only used for printing a<br>
file date/time for recovery, it will never affect normal editing.<br>
<br>
The Vim strftime() function directly uses the strftime() system function.<br>
localtime() uses the time() system function. getftime() uses the time<br>
returned by the stat() system function. If your system libraries are year<br>
2000 compliant, Vim is too.<br>
<br>
The user may create scripts for Vim that use external commands. These might<br>
introduce Y2K problems, but those are not really part of Vim itself.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
3. Credits <a class="Constant" href="intro.html#credits" name="credits">credits</a> <a class="Constant" href="intro.html#author" name="author">author</a> <a class="Constant" href="intro.html#Bram" name="Bram">Bram</a> <a class="Constant" href="intro.html#Moolenaar" name="Moolenaar">Moolenaar</a><br>
<br>
Most of Vim was written by Bram Moolenaar <Bram@vim.org>.<br>
<br>
Parts of the documentation come from several Vi manuals, written by:<br>
W.<span class="Special">N</span>. Joy<br>
Alan P.W. Hewett<br>
Mark Horton<br>
<br>
The Vim editor is based on Stevie and includes (ideas from) other software,<br>
worked on by the people mentioned here. Other people helped by sending me<br>
patches, suggestions and giving feedback about what is good and bad in Vim.<br>
<br>
Vim would never have become what it is now, without the help of these people!<br>
<br>
Ron Aaron Win32 GUI changes<br>
Mohsin Ahmed encryption<br>
Zoltan Arpadffy work on VMS port<br>
Tony Andrews Stevie<br>
Gert van Antwerpen changes for DJGPP on MS-DOS<br>
Berkeley DB(3) ideas for swap file implementation<br>
Keith Bostic Nvi<br>
Walter Briscoe Makefile updates, various patches<br>
Ralf Brown SPAWNO library for MS-DOS<br>
Robert Colon many useful remarks<br>
Marcin Dalecki GTK+ GUI port, toolbar icons, gettext()<br>
Kayhan Demirel sent me news in Uganda<br>
Chris & John Downey xvi (ideas for multi-windows version)<br>
Henk Elbers first VMS port<br>
Daniel Elstner GTK+ 2 port<br>
Eric Fischer Mac port, <a class="Type" href="options.html#'cindent'">'cindent'</a>, and other improvements<br>
Benji Fisher Answering lots of user questions<br>
Bill Foster Athena GUI port<br>
Google Lets me work on Vim one day a week<br>
Loic Grenie xvim (ideas for multi windows version)<br>
Sven Guckes Vim promoter and previous WWW page maintainer<br>
Darren Hiebert Exuberant ctags<br>
Jason Hildebrand GTK+ 2 port<br>
Bruce Hunsaker improvements for VMS port<br>
Andy Kahn Cscope support, GTK+ GUI port<br>
Oezguer Kesim Maintainer of Vim Mailing Lists<br>
Axel Kielhorn work on the Macintosh port<br>
Steve Kirkendall Elvis<br>
Roger Knobbe original port to Windows NT<br>
Sergey Laskavy Vim's help from Moscow<br>
Felix von Leitner Previous maintainer of Vim Mailing Lists<br>
David Leonard Port of Python extensions to Unix<br>
Avner Lottem Edit in right-to-left windows<br>
Flemming Madsen X11 client-server, various features and patches<br>
Tony Mechelynck answers many user questions<br>
Paul Moore Python interface extensions, many patches<br>
Katsuhito Nagano Work on multi-byte versions<br>
Sung-Hyun Nam Work on multi-byte versions<br>
Vince Negri Win32 GUI and generic console enhancements<br>
Steve Oualline Author of the first Vim book <a class="Identifier" href="usr_01.html#frombook">frombook</a><br>
Dominique Pelle valgrind reports and many fixes<br>
A.Politz Many bug reports and some fixes<br>
George V. Reilly Win32 port, Win32 GUI start-off<br>
Stephen Riehm bug collector<br>
Stefan Roemer various patches and help to users<br>
Ralf Schandl IBM OS/390 port<br>
Olaf Seibert DICE and BeBox version, regexp improvements<br>
Mortaza Shiran Farsi patches<br>
Peter da Silva termlib<br>
Paul Slootman OS/2 port<br>
Henry Spencer regular expressions<br>
Dany St-Amant Macintosh port<br>
Tim Thompson Stevie<br>
G. R. (Fred) Walter Stevie<br>
Sven Verdoolaege Perl interface<br>
Robert Webb Command-line completion, GUI versions, and<br>
lots of patches<br>
Ingo Wilken Tcl interface<br>
Mike Williams PostScript printing<br>
Juergen Weigert Lattice version, AUX improvements, UNIX and<br>
MS-DOS ports, autoconf<br>
Stefan 'Sec' Zehl Maintainer of vim.org<br>
<br>
I wish to thank all the people that sent me bug reports and suggestions. The<br>
list is too long to mention them all here. Vim would not be the same without<br>
the ideas from all these people: They keep Vim alive!<br>
<a class="Constant" href="intro.html#love" name="love">love</a> <a class="Constant" href="intro.html#peace" name="peace">peace</a> <a class="Constant" href="intro.html#friendship" name="friendship">friendship</a> <a class="Constant" href="intro.html#gross-national-happiness" name="gross-national-happiness">gross-national-happiness</a><br>
<br>
<br>
In this documentation there are several references to other versions of Vi:<br>
<a class="Constant" href="intro.html#Vi" name="Vi">Vi</a> <a class="Constant" href="intro.html#vi" name="vi">vi</a><br>
Vi "the original". Without further remarks this is the version<br>
of Vi that appeared in Sun OS 4.x. ":version" returns<br>
"Version 3.7, 6/7/85". Sometimes other versions are referred<br>
to. Only runs under Unix. Source code only available with a<br>
license. More information on Vi can be found through:<br>
<span class="Constant"><a href="http://vi-editor.org">http://vi-editor.org</a></span> [doesn't currently work...]<br>
<a class="Constant" href="intro.html#Posix" name="Posix">Posix</a><br>
Posix From the IEEE standard 1003.2, Part 2: Shell and utilities.<br>
Generally known as "Posix". This is a textual description of<br>
how Vi is supposed to work.<br>
See <a class="Identifier" href="vi_diff.html#posix-compliance">posix-compliance</a>.<br>
<a class="Constant" href="intro.html#Nvi" name="Nvi">Nvi</a><br>
Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.<br>
Very good compatibility with the original Vi, with a few extensions.<br>
The version used is 1.79. ":version" returns "Version 1.79<br>
(10/23/96)". There has been no release the last few years, although<br>
there is a development version 1.81.<br>
Source code is freely available.<br>
<a class="Constant" href="intro.html#Elvis" name="Elvis">Elvis</a><br>
Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't<br>
as flexible as Vim.<br>
The version used is 2.1. It is still being developed. Source code is<br>
freely available.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
4. Notation <a class="Constant" href="intro.html#notation" name="notation">notation</a><br>
<br>
When syntax highlighting is used to read this, text that is not typed<br>
literally is often highlighted with the Special group. These are items in [],<br>
{} and <>, and <span class="Special">CTRL-X</span>.<br>
<br>
<span class="Todo">Note</span> that Vim uses all possible characters in commands. Sometimes the [], {}<br>
and <> are part of what you type, the context should make this clear.<br>
<br>
<br>
[] Characters in square brackets are optional.<br>
<br>
<a class="Constant" href="intro.html#count" name="count">count</a> <a class="Constant" href="intro.html#[count]" name="[count]">[count]</a><br>
<span class="Special">[count]</span> An optional number that may precede the command to multiply<br>
or iterate the command. If no number is given, a count of one<br>
is used, unless otherwise noted. <span class="Todo">Note</span> that in this manual the<br>
<span class="Special">[count]</span> is not mentioned in the description of the command,<br>
but only in the explanation. This was done to make the<br>
commands easier to look up. If the <a class="Type" href="options.html#'showcmd'">'showcmd'</a> option is on,<br>
the (partially) entered count is shown at the bottom of the<br>
window. You can use <span class="Special"><Del></span> to erase the last digit (<a class="Identifier" href="various.html#N<Del>">N<Del></a>).<br>
<br>
<a class="Constant" href="intro.html#[quotex]" name="[quotex]">[quotex]</a><br>
["x] An optional register designation where text can be stored.<br>
See <a class="Identifier" href="change.html#registers">registers</a>. The x is a single character between 'a' and<br>
'z' or 'A' and 'Z' or '"', and in some cases (with the put<br>
command) between '0' and '9', '%', '#', or others. The<br>
uppercase and lowercase letter designate the same register,<br>
but the lowercase letter is used to overwrite the previous<br>
register contents, while the uppercase letter is used to<br>
append to the previous register contents. Without the ""x" or<br>
with """" the stored text is put into the unnamed register.<br>
<br>
<a class="Constant" href="intro.html#{}" name="{}">{}</a><br>
{} Curly braces denote parts of the command which must appear,<br>
but which can take a number of different values. The<br>
differences between Vim and Vi are also given in curly braces<br>
(this will be clear from the context).<br>
<br>
<a class="Constant" href="intro.html#{char1-char2}" name="{char1-char2}">{char1-char2}</a><br>
<span class="Special">{char1-char2}</span> A single character from the range char1 to char2. For<br>
example: <span class="Special">{a-z}</span> is a lowercase letter. Multiple ranges may be<br>
concatenated. For example, <span class="Special">{a-zA-Z0-9}</span> is any alphanumeric<br>
character.<br>
<br>
<a class="Constant" href="intro.html#{motion}" name="{motion}">{motion}</a> <a class="Constant" href="intro.html#movement" name="movement">movement</a><br>
<span class="Special">{motion}</span> A command that moves the cursor. These are explained in<br>
<a class="Identifier" href="motion.html">motion.txt</a>. Examples:<br>
w to start of next word<br>
b to begin of current word<br>
4j four lines down<br>
/The<span class="Special"><CR></span> to next occurrence of "The"<br>
This is used after an <a class="Identifier" href="motion.html#operator">operator</a> command to move over the text<br>
that is to be operated upon.<br>
- If the motion includes a count and the operator also has a<br>
count, the two counts are multiplied. For example: "2d3w"<br>
deletes six words.<br>
- The motion can be backwards, e.g. "db" to delete to the<br>
start of the word.<br>
- The motion can also be a mouse click. The mouse is not<br>
supported in every terminal though.<br>
- The ":omap" command can be used to map characters while an<br>
operator is pending.<br>
- Ex commands can be used to move the cursor. This can be<br>
used to call a function that does some complicated motion.<br>
The motion is always characterwise exclusive, no matter<br>
what ":" command is used. This means it's impossible to<br>
include the last character of a line without the line break<br>
(unless <a class="Type" href="options.html#'virtualedit'">'virtualedit'</a> is set).<br>
If the Ex command changes the text before where the operator<br>
starts or jumps to another buffer the result is<br>
unpredictable. It is possible to change the text further<br>
down. Jumping to another buffer is possible if the current<br>
buffer is not unloaded.<br>
<br>
<a class="Constant" href="intro.html#{Visual}" name="{Visual}">{Visual}</a><br>
<span class="Special">{Visual}</span> A selected text area. It is started with the "v", "V", or<br>
<span class="Special">CTRL-V</span> command, then any cursor movement command can be used<br>
to change the end of the selected text.<br>
This is used before an <a class="Identifier" href="motion.html#operator">operator</a> command to highlight the<br>
text that is to be operated upon.<br>
See <a class="Identifier" href="visual.html#Visual-mode">Visual-mode</a>.<br>
<br>
<a class="Constant" href="intro.html#<character>" name="<character>"><character></a><br>
<span class="Special"><character></span> A special character from the table below, optionally with<br>
modifiers, or a single ASCII character with modifiers.<br>
<br>
<a class="Constant" href="intro.html#'character'" name="'character'">'character'</a><br>
'c' A single ASCII character.<br>
<br>
<a class="Constant" href="intro.html#CTRL-{char}" name="CTRL-{char}">CTRL-{char}</a><br>
<span class="Special">CTRL-{char}</span> <span class="Special">{char}</span> typed as a control character; that is, typing <span class="Special">{char}</span><br>
while holding the CTRL key down. The case of <span class="Special">{char}</span> does not<br>
matter; thus <span class="Special">CTRL-A</span> and <span class="Special">CTRL-a</span> are equivalent. But on some<br>
terminals, using the SHIFT key will produce another code,<br>
don't use it then.<br>
<br>
<a class="Constant" href="intro.html#'option'" name="'option'">'option'</a><br>
<a class="Type" href="intro.html#'option'">'option'</a> An option, or parameter, that can be set to a value, is<br>
enclosed in single quotes. See <a class="Identifier" href="options.html#options">options</a>.<br>
<br>
<a class="Constant" href="intro.html#quotecommandquote" name="quotecommandquote">quotecommandquote</a><br>
"command" A reference to a command that you can type is enclosed in<br>
double quotes.<br>
<a class="Comment" href="map.html#:command">command</a> New style command, this distinguishes it from other quoted<br>
text and strings.<br>
<br>
<a class="Constant" href="intro.html#key-notation" name="key-notation">key-notation</a> <a class="Constant" href="intro.html#key-codes" name="key-codes">key-codes</a> <a class="Constant" href="intro.html#keycodes" name="keycodes">keycodes</a><br>
These names for keys are used in the documentation. They can also be used<br>
with the ":map" command (insert the key name by pressing <span class="Special">CTRL-K</span> and then the<br>
key you want the name for).<br>
<br>
<span class="PreProc">notation meaning equivalent decimal value(s)</span><br>
<span class="PreProc">-----------------------------------------------------------------------</span><br>
<span class="Special"><Nul></span> zero <span class="Special">CTRL-@</span> 0 (stored as 10) <a class="Constant" href="intro.html#<Nul>" name="<Nul>"><Nul></a><br>
<span class="Special"><BS></span> backspace <span class="Special">CTRL-H</span> 8 <a class="Constant" href="intro.html#backspace" name="backspace">backspace</a><br>
<span class="Special"><Tab></span> tab <span class="Special">CTRL-I</span> 9 <a class="Constant" href="intro.html#tab" name="tab">tab</a> <a class="Constant" href="intro.html#Tab" name="Tab">Tab</a><br>
<a class="Constant" href="intro.html#linefeed" name="linefeed">linefeed</a><br>
<span class="Special"><NL></span> linefeed <span class="Special">CTRL-J</span> 10 (used for <span class="Special"><Nul></span>)<br>
<span class="Special"><FF></span> formfeed <span class="Special">CTRL-L</span> 12 <a class="Constant" href="intro.html#formfeed" name="formfeed">formfeed</a><br>
<span class="Special"><CR></span> carriage return <span class="Special">CTRL-M</span> 13 <a class="Constant" href="intro.html#carriage-return" name="carriage-return">carriage-return</a><br>
<span class="Special"><Return></span> same as <span class="Special"><CR></span> <a class="Constant" href="intro.html#<Return>" name="<Return>"><Return></a><br>
<span class="Special"><Enter></span> same as <span class="Special"><CR></span> <a class="Constant" href="intro.html#<Enter>" name="<Enter>"><Enter></a><br>
<span class="Special"><Esc></span> escape <span class="Special">CTRL-[</span> 27 <a class="Constant" href="intro.html#escape" name="escape">escape</a> <a class="Constant" href="intro.html#<Esc>" name="<Esc>"><Esc></a><br>
<span class="Special"><Space></span> space 32 <a class="Constant" href="intro.html#space" name="space">space</a><br>
<span class="Special"><lt></span> less-than < 60 <a class="Constant" href="intro.html#<lt>" name="<lt>"><lt></a><br>
<span class="Special"><Bslash></span> backslash \ 92 <a class="Constant" href="intro.html#backslash" name="backslash">backslash</a> <a class="Constant" href="intro.html#<Bslash>" name="<Bslash>"><Bslash></a><br>
<span class="Special"><Bar></span> vertical bar | 124 <a class="Constant" href="intro.html#<Bar>" name="<Bar>"><Bar></a><br>
<span class="Special"><Del></span> delete 127<br>
<span class="Special"><CSI></span> command sequence intro ALT-Esc 155 <a class="Constant" href="intro.html#<CSI>" name="<CSI>"><CSI></a><br>
<span class="Special"><xCSI></span> CSI when typed in the GUI <a class="Constant" href="intro.html#<xCSI>" name="<xCSI>"><xCSI></a><br>
<br>
<span class="Special"><EOL></span> end-of-line (can be <span class="Special"><CR></span>, <span class="Special"><LF></span> or <span class="Special"><CR><LF></span>,<br>
depends on system and <a class="Type" href="options.html#'fileformat'">'fileformat'</a>) <a class="Constant" href="intro.html#<EOL>" name="<EOL>"><EOL></a><br>
<br>
<span class="Special"><Up></span> cursor-up <a class="Constant" href="intro.html#cursor-up" name="cursor-up">cursor-up</a> <a class="Constant" href="intro.html#cursor_up" name="cursor_up">cursor_up</a><br>
<span class="Special"><Down></span> cursor-down <a class="Constant" href="intro.html#cursor-down" name="cursor-down">cursor-down</a> <a class="Constant" href="intro.html#cursor_down" name="cursor_down">cursor_down</a><br>
<span class="Special"><Left></span> cursor-left <a class="Constant" href="intro.html#cursor-left" name="cursor-left">cursor-left</a> <a class="Constant" href="intro.html#cursor_left" name="cursor_left">cursor_left</a><br>
<span class="Special"><Right></span> cursor-right <a class="Constant" href="intro.html#cursor-right" name="cursor-right">cursor-right</a> <a class="Constant" href="intro.html#cursor_right" name="cursor_right">cursor_right</a><br>
<span class="Special"><S-Up></span> shift-cursor-up<br>
<span class="Special"><S-Down></span> shift-cursor-down<br>
<span class="Special"><S-Left></span> shift-cursor-left<br>
<span class="Special"><S-Right></span> shift-cursor-right<br>
<span class="Special"><C-Left></span> control-cursor-left<br>
<span class="Special"><C-Right></span> control-cursor-right<br>
<span class="Special"><F1></span> - <span class="Special"><F12></span> function keys 1 to 12 <a class="Constant" href="intro.html#function_key" name="function_key">function_key</a> <a class="Constant" href="intro.html#function-key" name="function-key">function-key</a><br>
<span class="Special"><S-F1></span> - <span class="Special"><S-F12></span> shift-function keys 1 to 12 <a class="Constant" href="intro.html#<S-F1>" name="<S-F1>"><S-F1></a><br>
<span class="Special"><Help></span> help key<br>
<span class="Special"><Undo></span> undo key<br>
<span class="Special"><Insert></span> insert key<br>
<span class="Special"><Home></span> home <a class="Constant" href="intro.html#home" name="home">home</a><br>
<span class="Special"><End></span> end <a class="Constant" href="intro.html#end" name="end">end</a><br>
<span class="Special"><PageUp></span> page-up <a class="Constant" href="intro.html#page_up" name="page_up">page_up</a> <a class="Constant" href="intro.html#page-up" name="page-up">page-up</a><br>
<span class="Special"><PageDown></span> page-down <a class="Constant" href="intro.html#page_down" name="page_down">page_down</a> <a class="Constant" href="intro.html#page-down" name="page-down">page-down</a><br>
<span class="Special"><kHome></span> keypad home (upper left) <a class="Constant" href="intro.html#keypad-home" name="keypad-home">keypad-home</a><br>
<span class="Special"><kEnd></span> keypad end (lower left) <a class="Constant" href="intro.html#keypad-end" name="keypad-end">keypad-end</a><br>
<span class="Special"><kPageUp></span> keypad page-up (upper right) <a class="Constant" href="intro.html#keypad-page-up" name="keypad-page-up">keypad-page-up</a><br>
<span class="Special"><kPageDown></span> keypad page-down (lower right) <a class="Constant" href="intro.html#keypad-page-down" name="keypad-page-down">keypad-page-down</a><br>
<span class="Special"><kPlus></span> keypad + <a class="Constant" href="intro.html#keypad-plus" name="keypad-plus">keypad-plus</a><br>
<span class="Special"><kMinus></span> keypad - <a class="Constant" href="intro.html#keypad-minus" name="keypad-minus">keypad-minus</a><br>
<span class="Special"><kMultiply></span> keypad * <a class="Constant" href="intro.html#keypad-multiply" name="keypad-multiply">keypad-multiply</a><br>
<span class="Special"><kDivide></span> keypad / <a class="Constant" href="intro.html#keypad-divide" name="keypad-divide">keypad-divide</a><br>
<span class="Special"><kEnter></span> keypad Enter <a class="Constant" href="intro.html#keypad-enter" name="keypad-enter">keypad-enter</a><br>
<span class="Special"><kPoint></span> keypad Decimal point <a class="Constant" href="intro.html#keypad-point" name="keypad-point">keypad-point</a><br>
<span class="Special"><k0></span> - <span class="Special"><k9></span> keypad 0 to 9 <a class="Constant" href="intro.html#keypad-0" name="keypad-0">keypad-0</a> <a class="Constant" href="intro.html#keypad-9" name="keypad-9">keypad-9</a><br>
<S-...> shift-key <a class="Constant" href="intro.html#shift" name="shift">shift</a> <a class="Constant" href="intro.html#<S-" name="<S-"><S-</a><br>
<C-...> control-key <a class="Constant" href="intro.html#control" name="control">control</a> <a class="Constant" href="intro.html#ctrl" name="ctrl">ctrl</a> <a class="Constant" href="intro.html#<C-" name="<C-"><C-</a><br>
<M-...> alt-key or meta-key <a class="Constant" href="intro.html#meta" name="meta">meta</a> <a class="Constant" href="intro.html#alt" name="alt">alt</a> <a class="Constant" href="intro.html#<M-" name="<M-"><M-</a><br>
<A-...> same as <M-...> <a class="Constant" href="intro.html#<A-" name="<A-"><A-</a><br>
<D-...> command-key (Macintosh only) <a class="Constant" href="intro.html#<D-" name="<D-"><D-</a><br>
<span class="Special"><t_xx></span> key with "xx" entry in termcap<br>
<span class="PreProc">-----------------------------------------------------------------------</span><br>
<br>
<span class="Todo">Note</span>: The shifted cursor keys, the help key, and the undo key are only<br>
available on a few terminals. On the Amiga, shifted function key 10 produces<br>
a code (CSI) that is also used by key sequences. It will be recognized only<br>
after typing another key.<br>
<br>
<span class="Todo">Note</span>: There are two codes for the delete key. 127 is the decimal ASCII value<br>
for the delete key, which is always recognized. Some delete keys send another<br>
value, in which case this value is obtained from the termcap entry "kD". Both<br>
values have the same effect. Also see <a class="Identifier" href="options.html#:fixdel">:fixdel</a>.<br>
<br>
<span class="Todo">Note</span>: The keypad keys are used in the same way as the corresponding "normal"<br>
keys. For example, <span class="Special"><kHome></span> has the same effect as <span class="Special"><Home></span>. If a keypad key<br>
sends the same raw key code as its non-keypad equivalent, it will be<br>
recognized as the non-keypad code. For example, when <span class="Special"><kHome></span> sends the same<br>
code as <span class="Special"><Home></span>, when pressing <span class="Special"><kHome></span> Vim will think <span class="Special"><Home></span> was pressed.<br>
Mapping <span class="Special"><kHome></span> will not work then.<br>
<br>
<a class="Constant" href="intro.html#<>" name="<>"><></a><br>
Examples are often given in the <> notation. Sometimes this is just to make<br>
clear what you need to type, but often it can be typed literally, e.g., with<br>
the ":map" command. The rules are:<br>
1. Any printable characters are typed directly, except backslash and '<'<br>
2. A backslash is represented with "\\", double backslash, or "<span class="Special"><Bslash></span>".<br>
3. A real '<' is represented with "\<" or "<span class="Special"><lt></span>". When there is no<br>
confusion possible, a '<' can be used directly.<br>
4. "<span class="Special"><key></span>" means the special key typed. This is the notation explained in<br>
the table above. A few examples:<br>
<span class="Special"><Esc></span> Escape key<br>
<span class="Special"><C-G></span> <span class="Special">CTRL-G</span><br>
<span class="Special"><Up></span> cursor up key<br>
<span class="Special"><C-LeftMouse></span> Control- left mouse click<br>
<span class="Special"><S-F11></span> Shifted function key 11<br>
<span class="Special"><M-a></span> Meta- a ('a' with bit 8 set)<br>
<span class="Special"><M-A></span> Meta- A ('A' with bit 8 set)<br>
<span class="Special"><t_kd></span> "kd" termcap entry (cursor down key)<br>
<br>
If you want to use the full <> notation in Vim, you have to make sure the '<'<br>
flag is excluded from <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a> (when <a class="Type" href="options.html#'compatible'">'compatible'</a> is not set, it already is<br>
by default).<br>
<div class="helpExample"> :set cpo-=<</div>
The <> notation uses <span class="Special"><lt></span> to escape the special meaning of key names. Using a<br>
backslash also works, but only when <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a> does not include the 'B' flag.<br>
<br>
Examples for mapping <span class="Special">CTRL-H</span> to the six characters "<span class="Special"><Home></span>":<br>
<div class="helpExample"> :imap <C-H> \<Home><br>
:imap <C-H> <lt>Home></div>
The first one only works when the 'B' flag is not in <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>. The second<br>
one always works.<br>
To get a literal "<span class="Special"><lt></span>" in a mapping:<br>
<div class="helpExample"> :map <C-L> <lt>lt></div>
<br>
For mapping, abbreviation and menu commands you can then copy-paste the<br>
examples and use them directly. Or type them literally, including the '<' and<br>
'>' characters. This does NOT work for other commands, like ":set" and<br>
":autocmd"!<br>
<br>
<span class="PreProc">==============================================================================</span><br>
5. Modes, introduction <a class="Constant" href="intro.html#vim-modes-intro" name="vim-modes-intro">vim-modes-intro</a> <a class="Constant" href="intro.html#vim-modes" name="vim-modes">vim-modes</a><br>
<br>
Vim has six BASIC modes:<br>
<br>
<a class="Constant" href="intro.html#Normal" name="Normal">Normal</a> <a class="Constant" href="intro.html#Normal-mode" name="Normal-mode">Normal-mode</a> <a class="Constant" href="intro.html#command-mode" name="command-mode">command-mode</a><br>
Normal mode In Normal mode you can enter all the normal editor<br>
commands. If you start the editor you are in this<br>
mode (unless you have set the <a class="Type" href="options.html#'insertmode'">'insertmode'</a> option,<br>
see below). This is also known as command mode.<br>
<br>
Visual mode This is like Normal mode, but the movement commands<br>
extend a highlighted area. When a non-movement<br>
command is used, it is executed for the highlighted<br>
area. See <a class="Identifier" href="visual.html#Visual-mode">Visual-mode</a>.<br>
If the <a class="Type" href="options.html#'showmode'">'showmode'</a> option is on "-- VISUAL --" is shown<br>
at the bottom of the window.<br>
<br>
Select mode This looks most like the MS-Windows selection mode.<br>
Typing a printable character deletes the selection<br>
and starts Insert mode. See <a class="Identifier" href="visual.html#Select-mode">Select-mode</a>.<br>
If the <a class="Type" href="options.html#'showmode'">'showmode'</a> option is on "-- SELECT --" is shown<br>
at the bottom of the window.<br>
<br>
Insert mode In Insert mode the text you type is inserted into the<br>
buffer. See <a class="Identifier" href="insert.html#Insert-mode">Insert-mode</a>.<br>
If the <a class="Type" href="options.html#'showmode'">'showmode'</a> option is on "-- INSERT --" is shown<br>
at the bottom of the window.<br>
<br>
Command-line mode In Command-line mode (also called Cmdline mode) you<br>
Cmdline mode can enter one line of text at the bottom of the<br>
window. This is for the Ex commands, ":", the pattern<br>
search commands, "?" and "/", and the filter command,<br>
"!". <a class="Identifier" href="cmdline.html#Cmdline-mode">Cmdline-mode</a><br>
<br>
Ex mode Like Command-line mode, but after entering a command<br>
you remain in Ex mode. Very limited editing of the<br>
command line. <a class="Identifier" href="intro.html#Ex-mode">Ex-mode</a><br>
<br>
There are seven ADDITIONAL modes. These are variants of the BASIC modes:<br>
<br>
<a class="Constant" href="intro.html#Operator-pending" name="Operator-pending">Operator-pending</a> <a class="Constant" href="intro.html#Operator-pending-mode" name="Operator-pending-mode">Operator-pending-mode</a><br>
Operator-pending mode This is like Normal mode, but after an operator<br>
command has started, and Vim is waiting for a <span class="Special">{motion}</span><br>
to specify the text that the operator will work on.<br>
<br>
Replace mode Replace mode is a special case of Insert mode. You<br>
can do the same things as in Insert mode, but for<br>
each character you enter, one character of the existing<br>
text is deleted. See <a class="Identifier" href="insert.html#Replace-mode">Replace-mode</a>.<br>
If the <a class="Type" href="options.html#'showmode'">'showmode'</a> option is on "-- REPLACE --" is<br>
shown at the bottom of the window.<br>
<br>
Virtual Replace mode Virtual Replace mode is similar to Replace mode, but<br>
instead of file characters you are replacing screen<br>
real estate. See <a class="Identifier" href="insert.html#Virtual-Replace-mode">Virtual-Replace-mode</a>.<br>
If the <a class="Type" href="options.html#'showmode'">'showmode'</a> option is on "-- VREPLACE --" is<br>
shown at the bottom of the window.<br>
<br>
Insert Normal mode Entered when <span class="Special">CTRL-O</span> given in Insert mode. This is<br>
like Normal mode, but after executing one command Vim<br>
returns to Insert mode.<br>
If the <a class="Type" href="options.html#'showmode'">'showmode'</a> option is on "-- (insert) --" is<br>
shown at the bottom of the window.<br>
<br>
Terminal Normal mode Using Normal mode in a terminal window. Making<br>
changes is impossible. Use a insert command, such as<br>
"a" or "i", to return control to the job running in<br>
the terminal. Also called <a class="Identifier" href="terminal.html#Terminal-mode">Terminal-mode</a>.<br>
<br>
Insert Visual mode Entered when starting a Visual selection from Insert<br>
mode, e.g., by using <span class="Special">CTRL-O</span> and then "v", "V" or<br>
<span class="Special">CTRL-V</span>. When the Visual selection ends, Vim returns<br>
to Insert mode.<br>
If the <a class="Type" href="options.html#'showmode'">'showmode'</a> option is on "-- (insert) VISUAL --"<br>
is shown at the bottom of the window.<br>
<br>
Insert Select mode Entered when starting Select mode from Insert mode.<br>
E.g., by dragging the mouse or <span class="Special"><S-Right></span>.<br>
When the Select mode ends, Vim returns to Insert mode.<br>
If the <a class="Type" href="options.html#'showmode'">'showmode'</a> option is on "-- (insert) SELECT --"<br>
is shown at the bottom of the window.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
6. Switching from mode to mode <a class="Constant" href="intro.html#mode-switching" name="mode-switching">mode-switching</a><br>
<br>
If for any reason you do not know which mode you are in, you can always get<br>
back to Normal mode by typing <span class="Special"><Esc></span> twice. This doesn't work for Ex mode<br>
though, use ":visual".<br>
You will know you are back in Normal mode when you see the screen flash or<br>
hear the bell after you type <span class="Special"><Esc></span>. However, when pressing <span class="Special"><Esc></span> after using<br>
<span class="Special">CTRL-O</span> in Insert mode you get a beep but you are still in Insert mode, type<br>
<span class="Special"><Esc></span> again.<br>
<br>
<a class="Constant" href="intro.html#i_esc" name="i_esc">i_esc</a><br>
<span class="PreProc">TO mode </span><br>
<span class="PreProc">Normal Visual Select Insert Replace Cmd-line Ex</span><br>
<span class="PreProc">FROM mode </span><br>
Normal v V ^V *4 *1 R gR : / ? ! Q<br>
Visual *2 ^G c C -- : --<br>
Select *5 ^O ^G *6 -- -- --<br>
Insert <span class="Special"><Esc></span> -- -- <span class="Special"><Insert></span> -- --<br>
Replace <span class="Special"><Esc></span> -- -- <span class="Special"><Insert></span> -- --<br>
Command-line *3 -- -- :start -- --<br>
Ex :vi -- -- -- -- --<br>
<br>
-- not possible<br>
<br>
*1 Go from Normal mode to Insert mode by giving the command "i", "I", "a",<br>
"A", "o", "O", "c", "C", "s" or S".<br>
*2 Go from Visual mode to Normal mode by giving a non-movement command, which<br>
causes the command to be executed, or by hitting <span class="Special"><Esc></span> "v", "V" or "<span class="Special">CTRL-V</span>"<br>
(see <a class="Identifier" href="visual.html#v_v">v_v</a>), which just stops Visual mode without side effects.<br>
*3 Go from Command-line mode to Normal mode by:<br>
- Hitting <span class="Special"><CR></span> or <span class="Special"><NL></span>, which causes the entered command to be executed.<br>
- Deleting the complete line (e.g., with <span class="Special">CTRL-U</span>) and giving a final <span class="Special"><BS></span>.<br>
- Hitting <span class="Special">CTRL-C</span> or <span class="Special"><Esc></span>, which quits the command-line without executing<br>
the command.<br>
In the last case <span class="Special"><Esc></span> may be the character defined with the <a class="Type" href="options.html#'wildchar'">'wildchar'</a><br>
option, in which case it will start command-line completion. You can<br>
ignore that and type <span class="Special"><Esc></span> again. <span class="Special">{Vi: when hitting <Esc> the command-line</span><br>
<span class="Special">is executed. This is unexpected for most people; therefore it was changed</span><br>
<span class="Special">in Vim. But when the <Esc> is part of a mapping, the command-line is</span><br>
<span class="Special">executed. If you want the Vi behaviour also when typing <Esc>, use ":cmap</span><br>
<span class="Special">^V<Esc> ^V^M"}</span><br>
*4 Go from Normal to Select mode by:<br>
- use the mouse to select text while <a class="Type" href="options.html#'selectmode'">'selectmode'</a> contains "mouse"<br>
- use a non-printable command to move the cursor while keeping the Shift<br>
key pressed, and the <a class="Type" href="options.html#'selectmode'">'selectmode'</a> option contains "key"<br>
- use "v", "V" or "<span class="Special">CTRL-V</span>" while <a class="Type" href="options.html#'selectmode'">'selectmode'</a> contains "cmd"<br>
- use "gh", "gH" or "g <span class="Special">CTRL-H</span>" <a class="Identifier" href="visual.html#g_CTRL-H">g_CTRL-H</a><br>
*5 Go from Select mode to Normal mode by using a non-printable command to move<br>
the cursor, without keeping the Shift key pressed.<br>
*6 Go from Select mode to Insert mode by typing a printable character. The<br>
selection is deleted and the character is inserted.<br>
<br>
If the <a class="Type" href="options.html#'insertmode'">'insertmode'</a> option is on, editing a file will start in Insert mode.<br>
<br>
<a class="Constant" href="intro.html#CTRL-\_CTRL-N" name="CTRL-\_CTRL-N">CTRL-\_CTRL-N</a> <a class="Constant" href="intro.html#i_CTRL-\_CTRL-N" name="i_CTRL-\_CTRL-N">i_CTRL-\_CTRL-N</a> <a class="Constant" href="intro.html#c_CTRL-\_CTRL-N" name="c_CTRL-\_CTRL-N">c_CTRL-\_CTRL-N</a> <a class="Constant" href="intro.html#v_CTRL-\_CTRL-N" name="v_CTRL-\_CTRL-N">v_CTRL-\_CTRL-N</a><br>
Additionally the command <span class="Special">CTRL-\</span> <span class="Special">CTRL-N</span> or <span class="Special"><C-\><C-N></span> can be used to go to<br>
Normal mode from any other mode. This can be used to make sure Vim is in<br>
Normal mode, without causing a beep like <span class="Special"><Esc></span> would. However, this does not<br>
work in Ex mode. When used after a command that takes an argument, such as<br>
<a class="Identifier" href="motion.html#f">f</a> or <a class="Identifier" href="motion.html#m">m</a>, the timeout set with <a class="Type" href="options.html#'ttimeoutlen'">'ttimeoutlen'</a> applies.<br>
<br>
<a class="Constant" href="intro.html#CTRL-\_CTRL-G" name="CTRL-\_CTRL-G">CTRL-\_CTRL-G</a> <a class="Constant" href="intro.html#i_CTRL-\_CTRL-G" name="i_CTRL-\_CTRL-G">i_CTRL-\_CTRL-G</a> <a class="Constant" href="intro.html#c_CTRL-\_CTRL-G" name="c_CTRL-\_CTRL-G">c_CTRL-\_CTRL-G</a> <a class="Constant" href="intro.html#v_CTRL-\_CTRL-G" name="v_CTRL-\_CTRL-G">v_CTRL-\_CTRL-G</a><br>
The command <span class="Special">CTRL-\</span> <span class="Special">CTRL-G</span> or <span class="Special"><C-\><C-G></span> can be used to go to Insert mode when<br>
<a class="Type" href="options.html#'insertmode'">'insertmode'</a> is set. Otherwise it goes to Normal mode. This can be used to<br>
make sure Vim is in the mode indicated by <a class="Type" href="options.html#'insertmode'">'insertmode'</a>, without knowing in<br>
what mode Vim currently is.<br>
<br>
<a class="Constant" href="intro.html#Q" name="Q">Q</a> <a class="Constant" href="intro.html#mode-Ex" name="mode-Ex">mode-Ex</a> <a class="Constant" href="intro.html#Ex-mode" name="Ex-mode">Ex-mode</a> <a class="Constant" href="intro.html#Ex" name="Ex">Ex</a> <a class="Constant" href="intro.html#EX" name="EX">EX</a> <a class="Constant" href="intro.html#E501" name="E501">E501</a><br>
Q Switch to "Ex" mode. This is a bit like typing ":"<br>
commands one after another, except:<br>
- You don't have to keep pressing ":".<br>
- The screen doesn't get updated after each command.<br>
- There is no normal command-line editing.<br>
- Mappings and abbreviations are not used.<br>
In fact, you are editing the lines with the "standard"<br>
line-input editing commands (<span class="Special"><Del></span> or <span class="Special"><BS></span> to erase,<br>
<span class="Special">CTRL-U</span> to kill the whole line).<br>
Vim will enter this mode by default if it's invoked as<br>
"ex" on the command-line.<br>
Use the ":vi" command <a class="Identifier" href="editing.html#:visual">:visual</a> to exit "Ex" mode.<br>
<span class="Todo">Note</span>: In older versions of Vim "Q" formatted text,<br>
that is now done with <a class="Identifier" href="change.html#gq">gq</a>. But if you use the<br>
<a class="Identifier" href="usr_05.html#vimrc_example.vim">vimrc_example.vim</a> script "Q" works like "gq".<br>
<br>
<a class="Constant" href="intro.html#gQ" name="gQ">gQ</a><br>
gQ Switch to "Ex" mode like with "Q", but really behave<br>
like typing ":" commands after another. All command<br>
line editing, completion etc. is available.<br>
Use the ":vi" command <a class="Identifier" href="editing.html#:visual">:visual</a> to exit "Ex" mode.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<span class="PreProc">==============================================================================</span><br>
7. The window contents <a class="Constant" href="intro.html#window-contents" name="window-contents">window-contents</a><br>
<br>
In Normal mode and Insert/Replace mode the screen window will show the current<br>
contents of the buffer: What You See Is What You Get. There are two<br>
exceptions:<br>
- When the <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a> option contains '$', and the change is within one line,<br>
the text is not directly deleted, but a '$' is put at the last deleted<br>
character.<br>
- When inserting text in one window, other windows on the same text are not<br>
updated until the insert is finished.<br>
<span class="Special">{Vi: The screen is not always updated on slow terminals}</span><br>
<br>
Lines longer than the window width will wrap, unless the <a class="Type" href="options.html#'wrap'">'wrap'</a> option is off<br>
(see below). The <a class="Type" href="options.html#'linebreak'">'linebreak'</a> option can be set to wrap at a blank character.<br>
<br>
If the window has room after the last line of the buffer, Vim will show '~' in<br>
the first column of the last lines in the window, like this:<br>
<br>
+-----------------------+<br>
|some line |<br>
|last line |<br>
|~ |<br>
|~ |<br>
+-----------------------+<br>
<br>
Thus the '~' lines indicate that the end of the buffer was reached.<br>
<br>
If the last line in a window doesn't fit, Vim will indicate this with a '@' in<br>
the first column of the last lines in the window, like this:<br>
<br>
+-----------------------+<br>
|first line |<br>
|second line |<br>
|@ |<br>
|@ |<br>
+-----------------------+<br>
<br>
Thus the '@' lines indicate that there is a line that doesn't fit in the<br>
window.<br>
<br>
When the "lastline" flag is present in the <a class="Type" href="options.html#'display'">'display'</a> option, you will not see<br>
'@' characters at the left side of window. If the last line doesn't fit<br>
completely, only the part that fits is shown, and the last three characters of<br>
the last line are replaced with "@@@", like this:<br>
<br>
+-----------------------+<br>
|first line |<br>
|second line |<br>
|a very long line that d|<br>
|oesn't fit in the wi@@@|<br>
+-----------------------+<br>
<br>
If there is a single line that is too long to fit in the window, this is a<br>
special situation. Vim will show only part of the line, around where the<br>
cursor is. There are no special characters shown, so that you can edit all<br>
parts of this line.<br>
<span class="Special">{Vi: gives an "internal error" on lines that do not fit in the window}</span><br>
<br>
The '@' occasion in the <a class="Type" href="options.html#'highlight'">'highlight'</a> option can be used to set special<br>
highlighting for the '@' and '~' characters. This makes it possible to<br>
distinguish them from real characters in the buffer.<br>
<br>
The <a class="Type" href="options.html#'showbreak'">'showbreak'</a> option contains the string to put in front of wrapped lines.<br>
<br>
<a class="Constant" href="intro.html#wrap-off" name="wrap-off">wrap-off</a><br>
If the <a class="Type" href="options.html#'wrap'">'wrap'</a> option is off, long lines will not wrap. Only the part that<br>
fits on the screen is shown. If the cursor is moved to a part of the line<br>
that is not shown, the screen is scrolled horizontally. The advantage of<br>
this method is that columns are shown as they are and lines that cannot fit<br>
on the screen can be edited. The disadvantage is that you cannot see all the<br>
characters of a line at once. The <a class="Type" href="options.html#'sidescroll'">'sidescroll'</a> option can be set to the<br>
minimal number of columns to scroll. <span class="Special">{Vi: has no 'wrap' option}</span><br>
<br>
All normal ASCII characters are displayed directly on the screen. The <span class="Special"><Tab></span><br>
is replaced with the number of spaces that it represents. Other non-printing<br>
characters are replaced with "^<span class="Special">{char}</span>", where <span class="Special">{char}</span> is the non-printing<br>
character with 64 added. Thus character 7 (bell) will be shown as "^G".<br>
Characters between 127 and 160 are replaced with "~<span class="Special">{char}</span>", where <span class="Special">{char}</span> is<br>
the character with 64 subtracted. These characters occupy more than one<br>
position on the screen. The cursor can only be positioned on the first one.<br>
<br>
If you set the <a class="Type" href="options.html#'number'">'number'</a> option, all lines will be preceded with their<br>
number. Tip: If you don't like wrapping lines to mix with the line numbers,<br>
set the <a class="Type" href="options.html#'showbreak'">'showbreak'</a> option to eight spaces:<br>
":set showbreak=\ \ \ \ \ \ \ \ "<br>
<br>
If you set the <a class="Type" href="options.html#'list'">'list'</a> option, <span class="Special"><Tab></span> characters will not be shown as several<br>
spaces, but as "^I". A '$' will be placed at the end of the line, so you can<br>
find trailing blanks.<br>
<br>
In Command-line mode only the command-line itself is shown correctly. The<br>
display of the buffer contents is updated as soon as you go back to Command<br>
mode.<br>
<br>
The last line of the window is used for status and other messages. The<br>
status messages will only be used if an option is on:<br>
<br>
<span class="PreProc">status message option default Unix default</span><br>
current mode <a class="Type" href="options.html#'showmode'">'showmode'</a> on on<br>
command characters <a class="Type" href="options.html#'showcmd'">'showcmd'</a> on off<br>
cursor position <a class="Type" href="options.html#'ruler'">'ruler'</a> off off<br>
<br>
The current mode is "-- INSERT --" or "-- REPLACE --", see <a class="Identifier" href="options.html#'showmode'">'showmode'</a>. The<br>
command characters are those that you typed but were not used yet. <span class="Special">{Vi: does</span><br>
<span class="Special">not show the characters you typed or the cursor position}</span><br>
<br>
If you have a slow terminal you can switch off the status messages to speed<br>
up editing:<br>
:set nosc noru nosm<br>
<br>
If there is an error, an error message will be shown for at least one second<br>
(in reverse video). <span class="Special">{Vi: error messages may be overwritten with other</span><br>
<span class="Special">messages before you have a chance to read them}</span><br>
<br>
Some commands show how many lines were affected. Above which threshold this<br>
happens can be controlled with the <a class="Type" href="options.html#'report'">'report'</a> option (default 2).<br>
<br>
On the Amiga Vim will run in a CLI window. The name Vim and the full name of<br>
the current file name will be shown in the title bar. When the window is<br>
resized, Vim will automatically redraw the window. You may make the window as<br>
small as you like, but if it gets too small not a single line will fit in it.<br>
Make it at least 40 characters wide to be able to read most messages on the<br>
last line.<br>
<br>
On most Unix systems, resizing the window is recognized and handled correctly<br>
by Vim. <span class="Special">{Vi: not ok}</span><br>
<br>
<span class="PreProc">==============================================================================</span><br>
8. Definitions <a class="Constant" href="intro.html#definitions" name="definitions">definitions</a><br>
<br>
screen The whole area that Vim uses to work in. This can be<br>
a terminal emulator window. Also called "the Vim<br>
window".<br>
window A view on a buffer.<br>
<br>
A screen contains one or more windows, separated by status lines and with the<br>
command line at the bottom.<br>
<br>
+-------------------------------+<br>
screen | window 1 | window 2 |<br>
| | |<br>
| | |<br>
|= status line =|= status line =|<br>
| window 3 |<br>
| |<br>
| |<br>
|==== status line ==============|<br>
|command line |<br>
+-------------------------------+<br>
<br>
The command line is also used for messages. It scrolls up the screen when<br>
there is not enough room in the command line.<br>
<br>
A difference is made between four types of lines:<br>
<br>
buffer lines The lines in the buffer. This is the same as the<br>
lines as they are read from/written to a file. They<br>
can be thousands of characters long.<br>
logical lines The buffer lines with folding applied. Buffer lines<br>
in a closed fold are changed to a single logical line:<br>
"+-- 99 lines folded". They can be thousands of<br>
characters long.<br>
window lines The lines displayed in a window: A range of logical<br>
lines with wrapping, line breaks, etc. applied. They<br>
can only be as long as the width of the window allows,<br>
longer lines are wrapped or truncated.<br>
screen lines The lines of the screen that Vim uses. Consists of<br>
the window lines of all windows, with status lines<br>
and the command line added. They can only be as long<br>
as the width of the screen allows. When the command<br>
line gets longer it wraps and lines are scrolled to<br>
make room.<br>
<br>
<span class="PreProc">buffer lines logical lines window lines screen lines</span><br>
<br>
1. one 1. one 1. +-- folded 1. +-- folded<br>
2. two 2. +-- folded 2. five 2. five<br>
3. three 3. five 3. six 3. six<br>
4. four 4. six 4. seven 4. seven<br>
5. five 5. seven 5. === status line ===<br>
6. six 6. aaa<br>
7. seven 7. bbb<br>
8. ccc ccc c<br>
1. aaa 1. aaa 1. aaa 9. cc<br>
2. bbb 2. bbb 2. bbb 10. ddd<br>
3. ccc ccc ccc 3. ccc ccc ccc 3. ccc ccc c 11. ~ <br>
4. ddd 4. ddd 4. cc 12. === status line ===<br>
5. ddd 13. (command line)<br>
6. ~ <br>
<br>
<span class="PreProc">==============================================================================</span><br>
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: -->
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。