Add /src/vim/release.sh, a script to compile and install vim
[msysgit.git] / share / vim / vim58 / doc / intro.txt
blobec8ac4adcbcda10a2e71daf92a334d6b3252e0ed
1 *intro.txt*     For Vim version 5.8.  Last change: 2001 May 31
4                   VIM REFERENCE MANUAL    by Bram Moolenaar
7 Introduction to Vim                                     *ref* *reference*
9 1. Introduction                 |intro|
10 2. Vim on the internet          |internet|
11 3. Credits                      |credits|
12 4. Notation                     |notation|
13 5. Modes, introduction          |vim-modes-intro|
14 6. Switching from mode to mode  |mode-switching|
15 7. The window contents          |window-contents|
17 ==============================================================================
18 1. Introduction                                         *intro*
20 Vim stands for Vi IMproved.  It used to be Vi IMitation, but there are so many
21 improvements that a name change was appropriate.  Vim is a text editor which
22 includes almost all the commands from the Unix program "Vi" and a lot of new
23 ones.  It is very useful for editing programs and other 8-bit ASCII text.  All
24 commands are given with the keyboard.  This has the advantage that you can
25 keep your fingers on the keyboard and your eyes on the screen.  For those who
26 want it, there is mouse support and a GUI version with scrollbars and menus
27 (see |gui.txt|).
29 A summary of this manual can be found in the file "help.txt", |help.txt|.  It
30 can be accessed from within Vim with the <Help> or <F1> key and with the
31 |:help| command (just type ":help", without the bars or quotes).  The
32 'helpfile' option can be set to the name of the help file, in case it is not
33 located in the default place.  You can jump to subjects like with tags: Use
34 CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back.
36 Throughout this manual the differences between Vi and Vim are mentioned in
37 curly braces, like this: {Vi does not have on-line help}.  See |vi_diff.txt|
38 for a summary of the differences between Vim and Vi.
40 This manual refers to Vim on various machines.  There may be small differences
41 between different computers and terminals.  Besides the remarks given in this
42 document, there is a separate document for each supported system, see
43 |sys-file-list|.
45 This manual is a reference for all the Vim commands and options.  This is not
46 an introduction to the use of Vi or Vim, it gets a bit complicated here and
47 there.  For beginners, there is a hands-on |tutor|.  For setting up your
48 preferences and writing Vim scripts see |vimrc-intro|.
50 There are many books on Vi that contain a section for beginners.  I can
51 recommend "Learning the Vi editor" by Linda Lamb and Arnold Robbins, published
52 by O'Reilly.  The sixth edition includes a chapter on Vim.  ISBN:
53 1-56592-426-6.  There is also a German translation.
55 ==============================================================================
56 2. Vim on the internet                                  *internet*
58                 *www* *faq* *FAQ* *ftp* *distribution* *download* *vim-online*
59 Vim online is a site where users can exchange Vim scripts, tips and other
60 things.  It has links to all other places.
61 The Vim pages contain the most recent information about Vim.  They also
62 contain links to the most recent version of Vim.  The FAQ is a list of
63 Frequently Asked Questions.  Read this if you have problems.
65         Vim online:     http://vim.sf.net/
66         Vim pages:      http://www.vim.org/
67         Latest news:    http://www.vim.org/news.html
68         VIM FAQ:        http://www.vim.org/faq/
69         Downloading:    ftp://ftp.vim.org/pub/vim/MIRRORS
72 Usenet News group where Vim is discussed:               *news* *usenet*
73         comp.editors
74 See http://www.vim.org/usenet.html.  This group is also for other editors.  If
75 you write about Vim, don't forget to mention that.
77                                                 *mail-list* *maillist*
78 There are several mailing lists for Vim:
79 <vim@vim.org>
80         For discussions about using existing versions of Vim: Useful mappings,
81         questions, answers, where to get a specific version, etc.
82 <vim-dev@vim.org>                               *vim-dev* *vimdev*
83         For discussions about changing Vim: New features, porting, patches,
84         beta-test versions, etc.
85 <vim-announce@vim.org>                          *vim-announce*
86         Announcements about new versions of Vim; also for beta-test versions
87         and ports to different systems.
88 <vim-multibyte@vim.org>                         *vim-multibyte*
89         For discussions about using and improving the multi-byte aspects of
90         Vim.
91 <vim-mac@vim.org>                               *vim-mac*
92         For discussions about using and improving the Macintosh version of
93         Vim.
95 See http://www.vim.org/mail.html.
97 NOTE:
98 - You can only send messages to these lists if you have subscribed!
99 - You need to send the messages from the same location as where you subscribed
100   from (to avoid spam mail).
101 - Maximum message size is 40000 characters.
103                                                 *subscribe-maillist*
104 If you want to join, send a message to
105         <vim-help@vim.org>
106 Make sure that your "From:" address is correct.  Then the list server will
107 give you help on how to subscribe.
109 You can retrieve old messages from the maillist software, and an index of
110 messages.  Ask vim-help for instructions.
112 Archives are kept at:                           *maillist-archive*
113 http://www.egroups.com/group/vim
114 http://www.egroups.com/group/vimdev
115 http://www.egroups.com/group/vimannounce
116 http://www.egroups.com/group/vim-multibyte
117 http://www.egroups.com/group/vim-mac
119 Another archive is at http://www.somelist.com in the "Editeurs" section (the
120 site is in French, the messages are in English).
123 Additional maillists:
125 <vim-fr@club.voila.fr>                          *french-maillist*
126         Vim list in the French language.  Subscribe by sending a message to
127                 <vim-fr-subscribe@club.voila.fr>
128         Or go to http://www.egroups.com/group/vim-fr.
131 Bug reports:                            *bugs* *bug-reports* *bugreport.vim*
132         Bram Moolenaar <Bram@vim.org>
133 Please be brief; all the time that is spend on answering mail is subtracted
134 from the time that is spent on improving Vim!  Always give a reproducible
135 example and try to find out which settings or other things influence the
136 appearance of the bug.  Try different machines, if possible.  Send me patches
137 if you can!
139 In case of doubt, use:
140 >  :so $VIMRUNTIME/bugreport.vim
141 This will create a file "bugreport.txt" in the current directory, with a lot
142 of information of your environment.  Before sending this out, check if it
143 doesn't contain any confidential information!
145                                                         *debug*
146 When Vim crashes in one of the test files, and you are using gcc for
147 compilation, here is what you can do to find out exactly where Vim crashes:
149 1. Compile Vim with the "-g" option (there is a line in the Makefile for this,
150    which you can uncomment).
152 2. Execute these commands (replace "11" with the test that fails):
153 >       cd testdir
154 >       gdb ../vim
155 >       run -u vimrc.unix -U NONE -s dotest.in test11.in
157 3. Check where Vim crashes, gdb should give a message for this.
159 4. Get a stack trace from gdb with this command:
160 >       where
161    You can check out different places in the stack trace with:
162 >       frame 3
163    Replace "3" with one of the numbers in the stack trace.
165                                                         *year-2000* *Y2K*
166 Since Vim internally doesn't use dates for editing, there is no year 2000
167 problem to worry about.  Vim does use the time in the form of seconds since
168 January 1st 1970.  It is used for a time-stamp check of the edited file and
169 the swap file, which is not critical and should only cause warning messages.
171 There might be a year 2038 problem, when the seconds don't fit in a 32 bit int
172 anymore.  This depends on the compiler, libraries and operating system.
173 Specifically, time_t and the ctime() function are used.  And the time_t is
174 stored in four bytes in the swap file.  But that's only used for printing a
175 file date/time for recovery, it will never affect normal editing.
177 The Vim strftime() function directly uses the strftime() system function.
178 localtime() uses the time() system function.  getftime() uses the time
179 returned by the stat() system function.  If your system libraries are year
180 2000 compliant, Vim is too.
182 The user may create scripts for Vim that use external commands.  These might
183 introduce Y2K problems, but those are not really part of Vim itself.
185 ==============================================================================
186 3. Credits                                              *credits* *author*
188 Most of Vim was written by Bram Moolenaar <Bram@vim.org>.
190 Parts of the documentation come from several Vi manuals, written by:
191         W.N. Joy
192         Alan P.W. Hewett
193         Mark Horton
195 The Vim editor is based on Stevie and includes (ideas from) other software,
196 worked on by the people mentioned here.  Other people helped by sending me
197 patches, suggestions and giving feedback about what is good and bad in Vim.
199 Vim would never have become what it is now, without the help of these people!
201         Ron Aaron               Win32 GUI changes
202         Dany St-Amant           Macintosh port
203         Tony Andrews            Stevie
204         Gert van Antwerpen      changes for DJGPP on MS-DOS
205         Berkeley DB(3)          ideas for swap file implementation
206         Keith Bostic            Nvi
207         Ralf Brown              SPAWNO library for MS-DOS
208         Robert Colon            many useful remarks
209         Marcin Dalecki          GTK+ GUI port, toolbar icons
210         Kayhan Demirel          sent me news in Uganda
211         Chris & John Downey     xvi (ideas for multi-windows version)
212         Henk Elbers             first VMS port
213         Eric Fischer            Mac port, 'cindent', and other improvements
214         Bill Foster             Athena GUI port
215         Loic Grenie             xvim (ideas for multi windows version)
216         Sven Guckes             Vim WWW page maintainer
217         Darren Hiebert          Exuberant ctags
218         Bruce Hunsaker          improvements for VMS port
219         Andy Kahn               Cscope support, GTK+ GUI port
220         Steve Kirkendall        Elvis
221         Roger Knobbe            original port to Windows NT
222         Sergey Laskavy          Vim's help from Moscow
223         Felix von Leitner       Maintainer of Vim Mailing Lists
224         David Leonard           Port of Python extensions to Unix
225         Avner Lottem            Edit in right-to-left windows
226         Flemming Madsen         Various features and patches
227         MicroSoft               Gave me a copy of DevStudio to compile Vim with
228         Paul Moore              Python interface extensions
229         Katsuhito Nagano        Work on multi-byte versions
230         Sung-Hyun Nam           Work on multi-byte versions
231         Vince Negri             Win32 GUI and generic console enhancements
232         George V. Reilly        Win32 port, Win32 GUI start-off
233         Stephen Riehm           bug collector
234         Stefan Roemer           various patches and help to users
235         Olaf Seibert            DICE and BeBox version, regexp improvements
236         Mortaza Shiran          Farsi patches
237         Peter da Silva          termlib
238         Paul Slootman           OS/2 port
239         Henry Spencer           regular expressions
240         Tim Thompson            Stevie
241         G. R. (Fred) Walter     Stevie
242         Sven Verdoolaege        Perl interface
243         Robert Webb             Command-line completion, GUI versions, and
244                                 lots of patches
245         Ingo Wilken             Tcl interface
246         Juergen Weigert         Lattice version, AUX improvements, UNIX and
247                                 MS-DOS ports, autoconf
248         Stefan 'Sec' Zehl       Maintainer of vim.org
250 I wish to thank all the people that sent me bug reports and suggestions.  The
251 list is too long to mention them all here.  Vim would not be the same without
252 the ideas from all these people: They keep Vim alive!
255 In this documentation there are several references to other versions of Vi:
256                                                         *Vi*
257 Vi      "the original".  Without further remarks this is the version
258         of Vi that appeared in Sun OS 4.x.  ":version" returns
259         "Version 3.7, 6/7/85".  Sometimes other versions are referred
260         to.  Only runs under Unix.  Source code only available with a
261         license.  More information on Vi can be found through:
262                 http://www.vim.org
263                                                         *Posix*
264 Posix   From the IEEE standard 1003.2, Part 2: Shell and utilities.
265         Generally known as "Posix".  This is a textual description of
266         how Vi is supposed to work.  The version used is a draft from
267         beginning 1996, so all remarks are "expected to comply to"
268         this.  Anything can change though...
269                                                         *Nvi*
270 Nvi     The "New" Vi.  The version of Vi that comes with BSD 4.4 and
271         many free Unix versions.  The version used is 1.79.
272         ":version" returns "Version 1.79 (10/23/96)".  Source code is
273         freely available.
274                                                         *Elvis*
275 Elvis   Another Vi clone, made by Steve Kirkendall.  The version used
276         is 2.1, the last official release.  Source code is freely
277         available.
279 ==============================================================================
280 4. Notation                                             *notation*
282 When syntax highlighting is used to read this, text that is not typed
283 literally is often highlighted with the Special group.  These are items in [],
284 {} and <>, and CTRL-X.
286 []              Characters in square brackets are optional.
288                                                         *count* *[count]*
289 [count]         An optional number that may precede the command to multiply
290                 or iterate the command.  If no number is given, a count of one
291                 is used, unless otherwise noted.  Note that in this manual the
292                 [count] is not mentioned in the description of the command,
293                 but only in the explanation.  This was done to make the
294                 commands easier to look up.  If the 'showcmd' option is on,
295                 the (partially) entered count is shown at the bottom of the
296                 window.  You can use <Del> to erase the last digit (|N<Del>|).
298                                                         *[quotex]*
299 ["x]            An optional register designation where text can be stored.
300                 See |registers|.  The x is a single character between 'a' and
301                 'z' or 'A' and 'Z' or '"', and in some cases (with the put
302                 command) between '0' and '9', '%', '#', ':' or '.'. The
303                 uppercase and lower case letter designate the same register,
304                 but the lower case letter is used to overwrite the previous
305                 register contents, while the uppercase letter is used to
306                 append to the previous register contents. Without the ""x" or
307                 with """" the stored text is put into the unnamed register.
309                                                         *{}*
310 {}              Curly braces denote parts of the command which must appear,
311                 but which can take a number of different values.  The
312                 differences between Vim and Vi are also given in curly braces
313                 (this will be clear from the context).
315                                                         *{char1-char2}*
316 {char1-char2}   A single character from the range char1 to char2.  For
317                 example: {a-z} is a lowercase letter.  Multiple ranges may be
318                 concatenated.  For example, {a-zA-Z0-9} is any alphanumeric
319                 character.
321                                                         *{motion}*
322 {motion}        A command that moves the cursor.  These are explained in
323                 |motion.txt|.  Examples:
324                         w               to start of next word
325                         4j              four lines down
326                         /The<CR>        to next occurrence of "The"
327                 This is used after an |operator| command to move over the text
328                 that is to be operated upon.
329                 If the motion includes a count and the operator also had a
330                 count, the two counts are multiplied.  For example: "2d3w"
331                 deletes six words.  The motion can also be a mouse click.  The
332                 mouse is currently only supported for MS-DOS, Win32, Linux
333                 console with GPM and xterm under Unix.  The ":omap" command
334                 can be used to map characters while an operator is pending.
336                                                         *{Visual}*
337 {Visual}        A selected text area.  It is started with the "v", "V", or
338                 CTRL-V command, then any cursor movement command can be used
339                 to change the end of the selected text.
340                 This is used before an |operator| command to highlight the
341                 text that is to be operated upon.
342                 See |Visual-mode|.
344                                                         *<character>*
345 <character>     A special character from the table below, optionally with
346                 modifiers, or a single ASCII character with modifiers.
348                                                         *'character'*
349 'c'             A single ASCII character.
351                                                         *CTRL-{char}*
352 CTRL-{char}     {char} typed as a control character; that is, typing {char}
353                 while holding the CTRL key down.  The case of {char} does not
354                 matter; thus CTRL-A and CTRL-a are equivalent.  But on some
355                 terminals, using the SHIFT key will produce another code,
356                 don't use it then.
358                                                         *'option'*
359 'option'        An option, or parameter, that can be set to a value, is
360                 enclosed in single quotes.  See |options|.
362                                                         *quotecommandquote*
363 "command"       A reference to a command that you can type is enclosed in
364                 double quotes.
366                                         *key-notation* *key-codes* *keycodes*
367 These names for keys are used in the documentation.  They can also be used
368 with the ":map" command.
370 notation        meaning             equivalent  decimal value(s)        ~
371 -----------------------------------------------------------------------
372 <Nul>           zero                    CTRL-@    0 (stored as 10) *<Nul>*
373 <BS>            backspace               CTRL-H    8     *backspace*
374 <Tab>           tab                     CTRL-I    9     *tab* *Tab*
375                                                         *linefeed*
376 <NL>            linefeed                CTRL-J   10 (used for <Nul>)
377 <FF>            formfeed                CTRL-L   12     *formfeed*
378 <CR>            carriage return         CTRL-M   13     *carriage-return*
379 <Enter>         same as <CR>                            *<Enter>*
380 <Esc>           escape                  CTRL-[   27     *escape* *<Esc>*
381 <Space>         space                            32     *space*
382 <lt>            less-then               <        60     *<lt>*
383 <Bslash>        backslash               \        92     *backslash* *<Bslash>*
384 <Bar>           vertical bar            |       124     *<Bar>*
385 <Del>           delete                          127
386 <CSI>           command sequence intro  ALT-Esc 155     *<CSI>*
387 <xCSI>          CSI when typed in the GUI               *<xCSI>*
389 <EOL>           end-of-line (can be <CR>, <LF> or <CR><LF>,
390                 depends on system and 'fileformat')     *<EOL>*
392 <Up>            cursor-up                       *cursor-up* *cursor_up*
393 <Down>          cursor-down                     *cursor-down* *cursor_down*
394 <Left>          cursor-left                     *cursor-left* *cursor_left*
395 <Right>         cursor-right                    *cursor-right* *cursor_right*
396 <S-Up>          shift-cursor-up
397 <S-Down>        shift-cursor-down
398 <S-Left>        shift-cursor-left
399 <S-Right>       shift-cursor-right
400 <C-Left>        control-cursor-left
401 <C-Right>       control-cursor-right
402 <F1> - <F12>    function keys 1 to 12           *function_key* *function-key*
403 <S-F1> - <S-F12> shift-function keys 1 to 12    *<S-F1>*
404 <Help>          help key
405 <Undo>          undo key
406 <Insert>        insert key
407 <Home>          home                            *home*
408 <End>           end                             *end*
409 <PageUp>        page-up                         *page_up* *page-up*
410 <PageDown>      page-down                       *page_down* *page-down*
411 <kHome>         keypad home (upper left)        *keypad-home*
412 <kEnd>          keypad end (lower left)         *keypad-end*
413 <kPageUp>       keypad page-up (upper right)    *keypad-page-up*
414 <kPageDown>     keypad page-down (lower right)  *keypad-page-down*
415 <kPlus>         keypad +                        *keypad-plus*
416 <kMinus>        keypad -                        *keypad-minus*
417 <kMultiply>     keypad *                        *keypad-multiply*
418 <kDivide>       keypad /                        *keypad-divide*
419 <kEnter>        keypad Enter                    *keypad-enter*
420 <S-...>         shift-key                       *shift*
421 <C-...>         control-key                     *control* *ctrl*
422 <M-...>         alt-key or meta-key             *meta* *alt*
423 <t_xx>          key with "xx" entry in termcap
424 -----------------------------------------------------------------------
426 Note: The shifted cursor keys, the help key, and the undo key are only
427 available on a few terminals.  On the Amiga, shifted function key 10 produces
428 a code (CSI) that is also used by key sequences.  It will be recognized only
429 after typing another key.
431 Note: There are two codes for the delete key.  127 is the decimal ASCII value
432 for the delete key, which is always recognized.  Some delete keys send another
433 value, in which case this value is obtained from the termcap entry "kD".  Both
434 values have the same effect.  Also see |:fixdel|.
436 Note: The keypad keys are used in the same way as the corresponding "normal"
437 keys.  For example, <kHome> has the same effect as <Home>.  If a keypad key
438 sends the same raw key code as it non-keypad equivalent, it will be recognized
439 as the non-keypad code.  For example, when <kHome> sends the same code as
440 <Home>, when pressing <kHome> Vim will think <Home> was pressed.  Mapping
441 <kHome> will not work then.
443                                                                 *<>*
444 Examples are often given in the <> notation.  Sometimes this is just to make
445 clear what you need to type, but often it can be typed literally, e.g., with
446 the ":map" command.  The rules are:
447  1.  Any printable characters are typed directly, except backslash and '<'
448  2.  A backslash is represented with "\\", double backslash, or "<Bslash>".
449  3.  A real '<' is represented with "\<" or "<lt>".  When there is no
450      confusion possible, a '<' can be used directly.
451  4.  "<key>" means the special key typed.  This is the notation explained in
452      the table above.  A few examples:
453            <Esc>                Escape key
454            <C-G>                CTRL-G
455            <Up>                 cursor up key
456            <C-LeftMouse>        Control- left mouse click
457            <S-F11>              Shifted function key 11
458            <M-a>                Meta- a  ('a' with bit 8 set)
459            <M-A>                Meta- A  ('A' with bit 8 set)
460            <t_kd>               "kd" termcap entry (cursor down key)
462 If you want to use the full <> notation in Vim, you have to make sure the '<'
463 flag is excluded from 'cpoptions' (when 'compatible' is not set, it already is
464 by default).
465 >       :set cpo-=<
466 The <> notation uses <lt> to escape the special meaning of key names.  Using a
467 backslash also work, but only when 'cpoptions' does not include the 'B' flag.
469 Examples for using a literal "<Home>" in a mapping:
470 >       :imap <C-H> \<Home>
471 >       :imap <C-H> <lt>Home>
472 The first one only works when the 'B' flag is not in 'cpoptions'.  The second
473 one always works.
474 To get a literal "<lt>" in a mapping:
475 >       :map <C-L> <lt>lt>
477 For mapping, abbreviation and menu commands you can then copy-paste the
478 examples and use them directly.  Or type them literally, including the '<' and
479 '>' characters.  This does NOT work for other commands, like ":set" and
480 ":autocmd"!
482 ==============================================================================
483 5. Modes, introduction                          *vim-modes-intro* *vim-modes*
485 Vim has six BASIC modes:
487                                         *Normal* *Normal-mode* *command-mode*
488 Normal mode             In Normal mode you can enter all the normal editor
489                         commands.  If you start the editor you are in this
490                         mode (unless you have set the 'insertmode' option,
491                         see below).  This is also known as command mode.
493 Visual mode             This is like Normal mode, but the movement commands
494                         extend a highlighted area.  When a non-movement
495                         command is used, it is executed for the highlighted
496                         area.  See |Visual-mode|.
497                         If the 'showmode' option is on "-- VISUAL --" is shown
498                         at the bottom of the window.
500 Select mode             This looks most like the MS-Windows selection mode.
501                         Typing a printable character deletes the selection
502                         and starts Insert mode.  See |Select-mode|.
503                         If the 'showmode' option is on "-- SELECT --" is shown
504                         at the bottom of the window.
506 Insert mode             In Insert mode the text you type is inserted into the
507                         buffer.  See |Insert-mode|.
508                         If the 'showmode' option is on "-- INSERT --" is shown
509                         at the bottom of the window.
511 Command-line mode       In Command-line mode (also called Cmdline mode) you
512 Cmdline mode            can enter one line of text at the bottom of the
513                         window.  This is for the Ex commands, ":", the pattern
514                         search commands, "?" and "/", and the filter command,
515                         "!".  |Cmdline-mode|
517 Ex mode                 Like Command-line mode, but after entering a command
518                         you remain in Ex mode.  Very limited editing of the
519                         command line.  |Ex-mode|
521 There are five ADDITIONAL modes:
523                                 *Operator-pending* *Operator-pending-mode*
524 Operator-pending mode   This is like Normal mode, but after an operator
525                         command has started, and Vim is waiting for a {motion}
526                         to specify the text that the operator will work on.
528 Replace mode            Replace mode is a special case of Insert mode.  You
529                         can do the same things as in Insert mode, but for
530                         each character you enter, one character of the existing
531                         text is deleted.  See |Replace-mode|.
532                         If the 'showmode' option is on "-- REPLACE --" is
533                         shown at the bottom of the window.
535 Insert Normal mode      Entered when CTRL-O given in Insert mode.  This is
536                         like Normal mode, but after executing one command Vim
537                         returns to Insert mode.
538                         If the 'showmode' option is on "-- (insert) --" is
539                         shown at the bottom of the window.
541 Insert Visual mode      Entered when starting a Visual selection from Insert
542                         mode, e.g., by using CTRL-O and then "v", "V" or
543                         CTRL-V.  When the Visual selection ends, Vim returns
544                         to Insert mode.
545                         If the 'showmode' option is on "-- (insert) VISUAL --"
546                         is shown at the bottom of the window.
548 Insert Select mode      Entered when starting Select mode from Insert mode.
549                         E.g., by dragging the mouse or <S-Right>.
550                         When the Select mode ends, Vim returns to Insert mode.
551                         If the 'showmode' option is on "-- (insert) SELECT --"
552                         is shown at the bottom of the window.
554 ==============================================================================
555 6. Switching from mode to mode                          *mode-switching*
557 If for any reason you do not know which mode you are in, you can always get
558 back to Normal mode by typing <Esc> twice.  You will know you are back in
559 Normal mode when you see the screen flash or hear the bell after you type
560 <Esc>.  This doesn't work for Ex mode, use ":visual".
562                                                         *i_esc*
563                 TO mode                                             ~
564                 Normal  Visual  Select  Insert    Replace   Cmd-line  Ex ~
565 FROM mode                                                                ~
566 Normal                  v V ^V    *4     *1         R       : / ? !   Q
567 Visual           *2               ^G     c C        --        :       --
568 Select           *5     ^O ^G            *6         --        --      --
569 Insert           <Esc>    --      --              <Insert>    --      --
570 Replace          <Esc>    --      --    <Insert>              --      --
571 Command-line     *3       --      --     :start     --                --
572 Ex               :vi      --      --     --         --        --
574 -  NA
575 -- not possible
577 *1 Go from Normal mode to Insert mode by giving the command "i", "I", "a",
578    "A", "o", "O", "c", "C", "s" or S".
579 *2 Go from Visual mode to Normal mode by giving a non-movement command, which
580    causes the command to be executed, or by hitting <Esc> "v", "V" or "CTRL-V"
581    (see |v_v|), which just stops Visual mode without side effects.
582 *3 Go from Command-line mode to Normal mode by:
583    - Hitting <CR> or <NL>, which causes the entered command to be executed.
584    - Deleting the complete line (e.g., with CTRL-U) and giving a final <BS>.
585    - Hitting CTRL-C or <Esc>, which quits the command-line without executing
586      the command.
587    In the last case <Esc> may be the character defined with the 'wildchar'
588    option, in which case it will start command-line completion.  You can
589    ignore that and type <Esc> again.  {Vi: when hitting <Esc> the command-line
590    is executed.  This is unexpected for most people; therefore it was changed
591    in Vim.  But when the <Esc> is part of a mapping, the command-line is
592    executed.  If you want the Vi behaviour also when typing <Esc>, use ":cmap
593    ^V<Esc> ^V^M"}
594 *4 Go from Normal to Select mode by:
595    - use the mouse to select text while 'selectmode' contains "mouse"
596    - use a non-printable command to move the cursor while keeping the Shift
597      key pressed, and the 'selectmode' option contains "key"
598    - use "v", "V" or "CTRL-V" while 'selectmode' contains "cmd"
599    - use "gh", "gH" or "g CTRL-H"  |g_CTRL-H|
600 *5 Go from Select mode to Normal mode by using a non-printable command to move
601    the cursor, without keeping the Shift key pressed.
602 *6 Go from Select mode to Insert mode by typing a printable character.  The
603    selection is deleted and the character is inserted.
605 If the 'insertmode' option is on, editing a file will start in Insert mode.
607         *CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N*
608 Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go to
609 Normal mode from any other mode.  This can be used to make sure Vim is in
610 Normal mode, without causing a beep like <Esc> would.
613                                         *Q* *mode-Ex* *Ex-mode* *Ex* *EX*
614 Q                       Switch to "Ex" mode.  This is a bit like typing ":"
615                         commands one after another, except:
616                         - You don't have to keep pressing ":".
617                         - The screen doesn't get updated after each command.
618                         - There is no normal command-line editing.
619                         - Mappings and abbreviations are not used.
620                         In fact, you are editing the lines with the "standard"
621                         line-input editing commands (<Del> or <BS> to erase,
622                         CTRL-U to kill the whole line).
623                         Vim will enter this mode by default if it's invoked as
624                         "ex" on the command-line.
625                         Use the ":vi" command |:visual| to exit "Ex" mode.
626                         Note: In older versions of Vim "Q" formatted text,
627                         that is now done with |gq|.
629 ==============================================================================
630 7. The window contents                                  *window-contents*
632 In Normal mode and Insert/Replace mode the screen window will show the current
633 contents of the buffer: What You See Is What You Get.  There are two
634 exceptions:
635 - When the 'cpoptions' option contains '$', and the change is within one line,
636   the text is not directly deleted, but a '$' is put at the last deleted
637   character.
638 - When inserting text in one window, other windows on the same text are not
639   updated until the insert is finished.
640 {Vi: The screen is not always updated on slow terminals}
642 Lines longer than the window width will wrap, unless the 'wrap' option is off
643 (see below).  The 'linebreak' option can be set to wrap at a blank character.
645 If the window has room after the last line of the buffer, Vim will show '~' in
646 the first column of the last lines in the window, like this:
648 >       some line
649 >       last line
650 >       ~ 
651 >       ~ 
653 Thus the '~' lines indicate that the end of the buffer was reached.
655 If the last line in a window doesn't fit, Vim will indicate this with a '@' in
656 the first column of the last lines in the window, like this:
658 >       first line
659 >       second line
660 >       @
661 >       @
663 Thus the '@' lines indicate that there is a line that doesn't fit in the
664 window.
666 When the "lastline" flag is present in the 'display' option, you will not see
667 '@' characters at the left side of window.  If the last line doesn't fit
668 completely, only the part that fits is shown, and the last three characters of
669 the last line are replaced with "@@@", like this:
671 >       first line
672 >       second line
673 >       a very long line that d
674 >       oesn't fit in the wi@@@
676 If there is a single line that is too long to fit in the window, this is a
677 special situation.  Vim will show only part of the line, around where the
678 cursor is.  There are no special characters shown, so that you can edit all
679 parts of this line.
680 {Vi: gives an "internal error" on lines that do not fit in the window}
682 The '@' occasion in the 'highlight' option can be used to set special
683 highlighting for the '@' and '~' characters.  This makes it possible to
684 distinguish them from real characters in the buffer.
686 The 'showbreak' option contains the string to put in front of wrapped lines.
688                                                         *wrap-off*
689 If the 'wrap' option is off, long lines will not wrap.  Only the part that
690 fits on the screen is shown.  If the cursor is moved to a part of the line
691 that is not shown, the screen is scrolled horizontally.  The advantage of
692 this method is that columns are shown as they are and lines that cannot fit
693 on the screen can be edited.  The disadvantage is that you cannot see all the
694 characters of a line at once.  The 'sidescroll' option can be set to the
695 minimal number of columns to scroll.  {Vi: has no 'wrap' option}
697 All normal ASCII characters are displayed directly on the screen.  The <Tab>
698 is replaced with the number of spaces that it represents.  Other non-printing
699 characters are replaced with "^{char}", where {char} is the non-printing
700 character with 64 added.  Thus character 7 (bell) will be shown as "^G".
701 Characters between 127 and 160 are replaced with "~{char}", where {char} is
702 the character with 64 subtracted.  These characters occupy more than one
703 position on the screen.  The cursor can only be positioned on the first one.
705 If you set the 'number' option, all lines will be preceded with their
706 number.  Tip: If you don't like wrapping lines to mix with the line numbers,
707 set the 'showbreak' option to eight spaces:
708         ":set showbreak=\ \ \ \ \ \ \ \ "
710 If you set the 'list' option, <Tab> characters will not be shown as several
711 spaces, but as "^I".  A '$' will be placed at the end of the line, so you can
712 find trailing blanks.
714 In Command-line mode only the command-line itself is shown correctly.  The
715 display of the buffer contents is updated as soon as you go back to Command
716 mode.
718 The last line of the window is used for status and other messages.  The
719 status messages will only be used if an option is on:
721 status message                  option       default    Unix default    ~
722 current mode                    'showmode'      on          on
723 command characters              'showcmd'       on          off
724 cursor position                 'ruler'         off         off
726 The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|.  The
727 command characters are those that you typed but were not used yet.  {Vi: does
728 not show the characters you typed or the cursor position}
730 If you have a slow terminal you can switch off the status messages to speed
731 up editing:
732         :set nosc noru nosm
734 If there is an error, an error message will be shown for at least one second
735 (in reverse video).  {Vi: error messages may be overwritten with other
736 messages before you have a chance to read them}
738 Some commands show how many lines were affected.  Above which threshold this
739 happens can be controlled with the 'report' option (default 2).
741 On the Amiga Vim will run in a CLI window.  The name Vim and the full name of
742 the current file name will be shown in the title bar.  When the window is
743 resized, Vim will automatically redraw the window.  You may make the window as
744 small as you like, but if it gets too small not a single line will fit in it.
745 Make it at least 40 characters wide to be able to read most messages on the
746 last line.
748 On most Unix systems, resizing the window is recognized and handled correctly
749 by Vim.  {Vi: not ok}
751  vim:ts=8:sw=8:tw=78: