Vim documentation: intro

main help file

*intro.txt*     For Vim version 7.3d.  Last change: 2010 Jul 20


		  VIM REFERENCE MANUAL    by Bram Moolenaar



Introduction to Vim					*ref* *reference*

1. Introduction			|intro|
2. Vim on the internet		|internet|
3. Credits			|credits|
4. Notation			|notation|
5. Modes, introduction		|vim-modes-intro|
6. Switching from mode to mode	|mode-switching|
7. The window contents		|window-contents|
8. Definitions			|definitions|

==============================================================================

1. Introduction						*intro*

Vim stands for Vi IMproved.  It used to be Vi IMitation, but there are so many
improvements that a name change was appropriate.  Vim is a text editor which
includes almost all the commands from the Unix program "Vi" and a lot of new
ones.  It is very useful for editing programs and other plain text.
   All commands are given with the keyboard.  This has the advantage that you
can keep your fingers on the keyboard and your eyes on the screen.  For those
who want it, there is mouse support and a GUI version with scrollbars and
menus (see |gui.txt|).

An overview of this manual can be found in the file "help.txt", |help.txt|.
It can be accessed from within Vim with the <Help> or <F1> key and with the
|:help| command (just type ":help", without the bars or quotes).
   The 'helpfile' option can be set to the name of the help file, in case it
is not located in the default place.  You can jump to subjects like with tags:
Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back.

Throughout this manual the differences between Vi and Vim are mentioned in
curly braces, like this: {Vi does not have on-line help}.  See |vi_diff.txt|
for a summary of the differences between Vim and Vi.

This manual refers to Vim on various machines.  There may be small differences
between different computers and terminals.  Besides the remarks given in this
document, there is a separate document for each supported system, see
|sys-file-list|.


							*pronounce*
Vim is pronounced as one word, like Jim, not vi-ai-em.  It's written with a
capital, since it's a name, again like Jim.

This manual is a reference for all the Vim commands and options.  This is not
an introduction to the use of Vi or Vim, it gets a bit complicated here and
there.  For beginners, there is a hands-on |tutor|.  To learn using Vim, read
the user manual |usr_toc.txt|.


							*book*
There are many books on Vi that contain a section for beginners.  There are
two books I can recommend:

	"Vim - Vi Improved" by Steve Oualline

This is the very first book completely dedicated to Vim.  It is very good for
beginners.  The most often used commands are explained with pictures and
examples.  The less often used commands are also explained, the more advanced
features are summarized.  There is a comprehensive index and a quick
reference.  Parts of this book have been included in the user manual
|frombook|.
Published by New Riders Publishing.  ISBN: 0735710015
For more information try one of these:
	http://iccf-holland.org/click5.html
	http://www.vim.org/iccf/click5.html

	"Learning the Vi editor" by Linda Lamb and Arnold Robbins

This is a book about Vi that includes a chapter on Vim (in the sixth edition).
The first steps in Vi are explained very well.  The commands that Vim adds are
only briefly mentioned.  There is also a German translation.
Published by O'Reilly.  ISBN: 1-56592-426-6.

==============================================================================

2. Vim on the internet					*internet*


			*www* *WWW*  *faq* *FAQ* *distribution* *download*
The Vim pages contain the most recent information about Vim.  They also
contain links to the most recent version of Vim.  The FAQ is a list of
Frequently Asked Questions.  Read this if you have problems.

 VIM home page:	http://www.vim.org/
 VIM FAQ:	http://vimdoc.sf.net/
 Downloading:	ftp://ftp.vim.org/pub/vim/MIRRORS



Usenet News group where Vim is discussed:		*news* *usenet*
	comp.editors
This group is also for other editors.  If you write about Vim, don't forget to
mention that.


						*mail-list* *maillist*
There are several mailing lists for Vim:
<vim@vim.org> 
	For discussions about using existing versions of Vim: Useful mappings,
	questions, answers, where to get a specific version, etc.  There are
	quite a few people watching this list and answering questions, also
	for beginners.  Don't hesitate to ask your question here.

<vim-dev@vim.org>				*vim-dev* *vimdev*
	For discussions about changing Vim: New features, porting, patches,
	beta-test versions, etc.

<vim-announce@vim.org>				*vim-announce*
	Announcements about new versions of Vim; also for beta-test versions
	and ports to different systems.  This is a read-only list.

<vim-multibyte@vim.org>				*vim-multibyte*
	For discussions about using and improving the multi-byte aspects of
	Vim.

<vim-mac@vim.org>				*vim-mac*
	For discussions about using and improving the Macintosh version of
	Vim.

 See	http://www.vim.org/maillist.php for the latest information.

NOTE:
- You can only send messages to these lists if you have subscribed!
- You need to send the messages from the same location as where you subscribed
  from (to avoid spam mail).
- Maximum message size is 40000 characters.


						*subscribe-maillist*
If you want to join, send a message to
	<vim-subscribe@vim.org> 
Make sure that your "From:" address is correct.  Then the list server will
give you help on how to subscribe.


						*maillist-archive*
For more information and archives look on the Vim maillist page:
	http://www.vim.org/maillist.php



Bug reports:				*bugs* *bug-reports* *bugreport.vim*

Send bug reports to: Vim bugs <bugs@vim.org> 
This is not a maillist but the message is redirected to the Vim maintainer.
Please be brief; all the time that is spent on answering mail is subtracted
from the time that is spent on improving Vim!  Always give a reproducible
example and try to find out which settings or other things influence the
appearance of the bug.  Try different machines, if possible.  Send me patches
if you can!

It will help to include information about the version of Vim you are using and
your setup.  You can get the information with this command:
   :so $VIMRUNTIME/bugreport.vim
This will create a file "bugreport.txt" in the current directory, with a lot
of information of your environment.  Before sending this out, check if it
doesn't contain any confidential information!

If Vim crashes, please try to find out where.  You can find help on this here:
|debug.txt|.

In case of doubt or when you wonder if the problem has already been fixed but
you can't find a fix for it, become a member of the vim-dev maillist and ask
your question there. |maillist|


							*year-2000* *Y2K*
Since Vim internally doesn't use dates for editing, there is no year 2000
problem to worry about.  Vim does use the time in the form of seconds since
January 1st 1970.  It is used for a time-stamp check of the edited file and
the swap file, which is not critical and should only cause warning messages.

There might be a year 2038 problem, when the seconds don't fit in a 32 bit int
anymore.  This depends on the compiler, libraries and operating system.
Specifically, time_t and the ctime() function are used.  And the time_t is
stored in four bytes in the swap file.  But that's only used for printing a
file date/time for recovery, it will never affect normal editing.

The Vim strftime() function directly uses the strftime() system function.
localtime() uses the time() system function.  getftime() uses the time
returned by the stat() system function.  If your system libraries are year
2000 compliant, Vim is too.

The user may create scripts for Vim that use external commands.  These might
introduce Y2K problems, but those are not really part of Vim itself.

==============================================================================

3. Credits				*credits* *author* *Bram* *Moolenaar*

Most of Vim was written by Bram Moolenaar <Bram@vim.org>. 

Parts of the documentation come from several Vi manuals, written by:
	W.N. Joy
	Alan P.W. Hewett
	Mark Horton

The Vim editor is based on Stevie and includes (ideas from) other software,
worked on by the people mentioned here.  Other people helped by sending me
patches, suggestions and giving feedback about what is good and bad in Vim.

Vim would never have become what it is now, without the help of these people!

	Ron Aaron		Win32 GUI changes
	Mohsin Ahmed		encryption
	Zoltan Arpadffy		work on VMS port
	Tony Andrews		Stevie
	Gert van Antwerpen	changes for DJGPP on MS-DOS
	Berkeley DB(3)		ideas for swap file implementation
	Keith Bostic		Nvi
	Walter Briscoe		Makefile updates, various patches
	Ralf Brown		SPAWNO library for MS-DOS
	Robert Colon		many useful remarks
	Marcin Dalecki		GTK+ GUI port, toolbar icons, gettext()
	Kayhan Demirel		sent me news in Uganda
	Chris & John Downey	xvi (ideas for multi-windows version)
	Henk Elbers		first VMS port
	Daniel Elstner		GTK+ 2 port
	Eric Fischer		Mac port, 'cindent', and other improvements
	Benji Fisher		Answering lots of user questions
	Bill Foster		Athena GUI port
	Google			Lets me work on Vim one day a week
	Loic Grenie		xvim (ideas for multi windows version)
	Sven Guckes		Vim promoter and previous WWW page maintainer
	Darren Hiebert		Exuberant ctags
	Jason Hildebrand	GTK+ 2 port
	Bruce Hunsaker		improvements for VMS port
	Andy Kahn		Cscope support, GTK+ GUI port
	Oezguer Kesim		Maintainer of Vim Mailing Lists
	Axel Kielhorn		work on the Macintosh port
	Steve Kirkendall	Elvis
	Roger Knobbe		original port to Windows NT
	Sergey Laskavy		Vim's help from Moscow
	Felix von Leitner	Previous maintainer of Vim Mailing Lists
	David Leonard		Port of Python extensions to Unix
	Avner Lottem		Edit in right-to-left windows
	Flemming Madsen		X11 client-server, various features and patches
	Tony Mechelynck		answers many user questions
	Paul Moore		Python interface extensions, many patches
	Katsuhito Nagano	Work on multi-byte versions
	Sung-Hyun Nam		Work on multi-byte versions
	Vince Negri		Win32 GUI and generic console enhancements
	Steve Oualline		Author of the first Vim book |frombook|
	Dominique Pelle		valgrind reports and many fixes
	A.Politz		Many bug reports and some fixes
	George V. Reilly	Win32 port, Win32 GUI start-off
	Stephen Riehm		bug collector
	Stefan Roemer		various patches and help to users
	Ralf Schandl		IBM OS/390 port
	Olaf Seibert		DICE and BeBox version, regexp improvements
	Mortaza Shiran		Farsi patches
	Peter da Silva		termlib
	Paul Slootman		OS/2 port
	Henry Spencer		regular expressions
	Dany St-Amant		Macintosh port
	Tim Thompson		Stevie
	G. R. (Fred) Walter	Stevie
	Sven Verdoolaege	Perl interface
	Robert Webb		Command-line completion, GUI versions, and
				lots of patches
	Ingo Wilken		Tcl interface
	Mike Williams		PostScript printing
	Juergen Weigert		Lattice version, AUX improvements, UNIX and
				MS-DOS ports, autoconf
	Stefan 'Sec' Zehl	Maintainer of vim.org

I wish to thank all the people that sent me bug reports and suggestions.  The
list is too long to mention them all here.  Vim would not be the same without
the ideas from all these people: They keep Vim alive!


In this documentation there are several references to other versions of Vi:

							*Vi* *vi*
Vi	"the original".  Without further remarks this is the version
	of Vi that appeared in Sun OS 4.x.  ":version" returns
	"Version 3.7, 6/7/85".  Sometimes other versions are referred
	to.  Only runs under Unix.  Source code only available with a
	license.  More information on Vi can be found through:
	http://vi-editor.org [doesn't currently work...]

							*Posix*
Posix	From the IEEE standard 1003.2, Part 2: Shell and utilities.
	Generally known as "Posix".  This is a textual description of
	how Vi is supposed to work.
	See |posix-compliance|.

							*Nvi*
Nvi	The "New" Vi.  The version of Vi that comes with BSD 4.4 and FreeBSD.
	Very good compatibility with the original Vi, with a few extensions.
	The version used is 1.79.  ":version" returns "Version 1.79
	(10/23/96)".  There has been no release the last few years, although
	there is a development version 1.81.
	Source code is freely available.

							*Elvis*
Elvis	Another Vi clone, made by Steve Kirkendall.  Very compact but isn't
	as flexible as Vim.
	The version used is 2.1.  It is still being developed.  Source code is
	freely available.

==============================================================================

4. Notation						*notation*

When syntax highlighting is used to read this, text that is not typed
literally is often highlighted with the Special group.  These are items in [],
{} and <>, and CTRL-X.

Note that Vim uses all possible characters in commands.  Sometimes the [], {}
and <> are part of what you type, the context should make this clear.


[]		Characters in square brackets are optional.


						    *count* *[count]* *E489*
[count]		An optional number that may precede the command to multiply
		or iterate the command.  If no number is given, a count of one
		is used, unless otherwise noted.  Note that in this manual the
		[count] is not mentioned in the description of the command,
		but only in the explanation.  This was done to make the
		commands easier to look up.  If the 'showcmd' option is on,
		the (partially) entered count is shown at the bottom of the
		window.  You can use <Del> to erase the last digit (|N<Del>|).


							*[quotex]*
["x]		An optional register designation where text can be stored.
		See |registers|.  The x is a single character between 'a' and
		'z' or 'A' and 'Z' or '"'', and in some cases (with the put
		command) between '0' and '9', '%', '#', or others.  The
		uppercase and lowercase letter designate the same register,
		but the lowercase letter is used to overwrite the previous
		register contents, while the uppercase letter is used to
		append to the previous register contents.  Without the ""x" or
		with """" the stored text is put into the unnamed register.


							*{}*
{}		Curly braces denote parts of the command which must appear,
		but which can take a number of different values.  The
		differences between Vim and Vi are also given in curly braces
		(this will be clear from the context).


							*{char1-char2}*
{char1-char2}	A single character from the range char1 to char2.  For
		example: {a-z} is a lowercase letter.  Multiple ranges may be
		concatenated.  For example, {a-zA-Z0-9} is any alphanumeric
		character.


						*{motion}* *movement*
{motion}	A command that moves the cursor.  These are explained in
		|motion.txt|.  Examples:
			w		to start of next word
			b		to begin of current word
			4j		four lines down
			/The<CR>	to next occurrence of "The"
		This is used after an |operator| command to move over the text
		that is to be operated upon.
		- If the motion includes a count and the operator also has a
		  count, the two counts are multiplied.  For example: "2d3w"
		  deletes six words.
		- The motion can be backwards, e.g. "db" to delete to the
		  start of the word.
		- The motion can also be a mouse click.  The mouse is not
		  supported in every terminal though.
		- The ":omap" command can be used to map characters while an
		  operator is pending.
		- Ex commands can be used to move the cursor.  This can be
		  used to call a function that does some complicated motion.
		  The motion is always characterwise exclusive, no matter
		  what ":" command is used.  This means it's impossible to
		  include the last character of a line without the line break
		  (unless 'virtualedit' is set).
		  If the Ex command changes the text before where the operator
		  starts or jumps to another buffer the result is
		  unpredictable.  It is possible to change the text further
		  down.  Jumping to another buffer is possible if the current
		  buffer is not unloaded.


							*{Visual}*
{Visual}	A selected text area.  It is started with the "v", "V", or
		CTRL-V command, then any cursor movement command can be used
		to change the end of the selected text.
		This is used before an |operator| command to highlight the
		text that is to be operated upon.
		See |Visual-mode|.


							*<character>*
<character>	A special character from the table below, optionally with
		modifiers, or a single ASCII character with modifiers.


							*'character'*
'c'		A single ASCII character.


							*CTRL-{char}*
CTRL-{char}	{char} typed as a control character; that is, typing {char}
		while holding the CTRL key down.  The case of {char} does not
		matter; thus CTRL-A and CTRL-a are equivalent.  But on some
		terminals, using the SHIFT key will produce another code,
		don't use it then.


							*'option'*
'option'	An option, or parameter, that can be set to a value, is
		enclosed in single quotes.  See |options|.


							*quotecommandquote*
"command"	A reference to a command that you can type is enclosed in
		double quotes.


					*key-notation* *key-codes* *keycodes*
These names for keys are used in the documentation.  They can also be used
with the ":map" command (insert the key name by pressing CTRL-K and then the
key you want the name for).

notation	meaning		    equivalent	decimal value(s)	

<Nul>		zero			CTRL-@	  0 (stored as 10) *<Nul>*

<BS>		backspace		CTRL-H	  8	*backspace*

<Tab>		tab			CTRL-I	  9	*tab* *Tab*

							*linefeed*
<NL>		linefeed		CTRL-J	 10 (used for <Nul>)

<FF>		formfeed		CTRL-L	 12	*formfeed*

<CR>		carriage return		CTRL-M	 13	*carriage-return*

<Return>	same as <CR>				*<Return>*

<Enter>		same as <CR>				*<Enter>*

<Esc>		escape			CTRL-[	 27	*escape* *<Esc>*

<Space>		space				 32	*space*

<lt>		less-than		<	 60	*<lt>*

<Bslash>	backslash		\	 92	*backslash* *<Bslash>*

<Bar>		vertical bar		|	124	*<Bar>*
<Del>		delete				127

<CSI>		command sequence intro  ALT-Esc 155	*<CSI>*

<xCSI>		CSI when typed in the GUI		*<xCSI>*

<EOL>		end-of-line (can be <CR>, <LF> or <CR><LF>,

		depends on system and 'fileformat')	*<EOL>*


<Up>		cursor-up			*cursor-up* *cursor_up*

<Down>		cursor-down			*cursor-down* *cursor_down*

<Left>		cursor-left			*cursor-left* *cursor_left*

<Right>		cursor-right			*cursor-right* *cursor_right*
<S-Up>		shift-cursor-up
<S-Down>	shift-cursor-down
<S-Left>	shift-cursor-left
<S-Right>	shift-cursor-right
<C-Left>	control-cursor-left
<C-Right>	control-cursor-right

<F1> - <F12>	function keys 1 to 12		*function_key* *function-key*

<S-F1> - <S-F12> shift-function keys 1 to 12	*<S-F1>*
<Help>		help key
<Undo>		undo key
<Insert>	insert key

<Home>		home				*home*

<End>		end				*end*

<PageUp>	page-up				*page_up* *page-up*

<PageDown>	page-down			*page_down* *page-down*

<kHome>		keypad home (upper left)	*keypad-home*

<kEnd>		keypad end (lower left)		*keypad-end*

<kPageUp>	keypad page-up (upper right)	*keypad-page-up*

<kPageDown>	keypad page-down (lower right)	*keypad-page-down*

<kPlus>		keypad +			*keypad-plus*

<kMinus>	keypad -			*keypad-minus*

<kMultiply>	keypad *			*keypad-multiply*

<kDivide>	keypad /			*keypad-divide*

<kEnter>	keypad Enter			*keypad-enter*

<kPoint>	keypad Decimal point		*keypad-point*

<k0> - <k9>	keypad 0 to 9			*keypad-0* *keypad-9*

<S-...>		shift-key			*shift* *<S-*

<C-...>		control-key			*control* *ctrl* *<C-*

<M-...>		alt-key or meta-key		*meta* *alt* *<M-*

<A-...>		same as <M-...>			*<A-*

<D-...>		command-key (Macintosh only)	*<D-*
<t_xx>		key with "xx" entry in termcap

Note: The shifted cursor keys, the help key, and the undo key are only
available on a few terminals.  On the Amiga, shifted function key 10 produces
a code (CSI) that is also used by key sequences.  It will be recognized only
after typing another key.

Note: There are two codes for the delete key.  127 is the decimal ASCII value
for the delete key, which is always recognized.  Some delete keys send another
value, in which case this value is obtained from the termcap entry "kD".  Both
values have the same effect.  Also see |:fixdel|.

Note: The keypad keys are used in the same way as the corresponding "normal"
keys.  For example, <kHome> has the same effect as <Home>.  If a keypad key
sends the same raw key code as its non-keypad equivalent, it will be
recognized as the non-keypad code.  For example, when <kHome> sends the same
code as <Home>, when pressing <kHome> Vim will think <Home> was pressed.
Mapping <kHome> will not work then.


								*<>*
Examples are often given in the <> notation.  Sometimes th