Bram Moolenaar | 00333fa | 2007-05-12 14:50:38 +0000 | [diff] [blame] | 1 | *usr_01.txt* For Vim version 7.1. Last change: 2006 Oct 08 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
| 3 | VIM USER MANUAL - by Bram Moolenaar |
| 4 | |
| 5 | About the manuals |
| 6 | |
| 7 | |
| 8 | This chapter introduces the manuals available with Vim. Read this to know the |
| 9 | conditions under which the commands are explained. |
| 10 | |
| 11 | |01.1| Two manuals |
| 12 | |01.2| Vim installed |
| 13 | |01.3| Using the Vim tutor |
| 14 | |01.4| Copyright |
| 15 | |
| 16 | Next chapter: |usr_02.txt| The first steps in Vim |
| 17 | Table of contents: |usr_toc.txt| |
| 18 | |
| 19 | ============================================================================== |
| 20 | *01.1* Two manuals |
| 21 | |
| 22 | The Vim documentation consists of two parts: |
| 23 | |
| 24 | 1. The User manual |
| 25 | Task oriented explanations, from simple to complex. Reads from start to |
| 26 | end like a book. |
| 27 | |
| 28 | 2. The Reference manual |
| 29 | Precise description of how everything in Vim works. |
| 30 | |
| 31 | The notation used in these manuals is explained here: |notation| |
| 32 | |
| 33 | |
| 34 | JUMPING AROUND |
| 35 | |
| 36 | The text contains hyperlinks between the two parts, allowing you to quickly |
| 37 | jump between the description of an editing task and a precise explanation of |
| 38 | the commands and options used for it. Use these two commands: |
| 39 | |
| 40 | Press CTRL-] to jump to a subject under the cursor. |
| 41 | Press CTRL-O to jump back (repeat to go further back). |
| 42 | |
| 43 | Many links are in vertical bars, like this: |bars|. An option name, like |
| 44 | 'number', a command in double quotes like ":write" and any other word can also |
| 45 | be used as a link. Try it out: Move the cursor to CTRL-] and press CTRL-] |
| 46 | on it. |
| 47 | |
| 48 | Other subjects can be found with the ":help" command, see |help.txt|. |
| 49 | |
| 50 | ============================================================================== |
| 51 | *01.2* Vim installed |
| 52 | |
| 53 | Most of the manuals assume that Vim has been properly installed. If you |
| 54 | didn't do that yet, or if Vim doesn't run properly (e.g., files can't be found |
| 55 | or in the GUI the menus do not show up) first read the chapter on |
| 56 | installation: |usr_90.txt|. |
| 57 | *not-compatible* |
| 58 | The manuals often assume you are using Vim with Vi-compatibility switched |
| 59 | off. For most commands this doesn't matter, but sometimes it is important, |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 60 | e.g., for multi-level undo. An easy way to make sure you are using a nice |
| 61 | setup is to copy the example vimrc file. By doing this inside Vim you don't |
| 62 | have to check out where it is located. How to do this depends on the system |
| 63 | you are using: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 64 | |
| 65 | Unix: > |
| 66 | :!cp -i $VIMRUNTIME/vimrc_example.vim ~/.vimrc |
| 67 | MS-DOS, MS-Windows, OS/2: > |
| 68 | :!copy $VIMRUNTIME/vimrc_example.vim $VIM/_vimrc |
| 69 | Amiga: > |
| 70 | :!copy $VIMRUNTIME/vimrc_example.vim $VIM/.vimrc |
| 71 | |
| 72 | If the file already exists you probably want to keep it. |
| 73 | |
| 74 | If you start Vim now, the 'compatible' option should be off. You can check it |
| 75 | with this command: > |
| 76 | |
| 77 | :set compatible? |
| 78 | |
| 79 | If it responds with "nocompatible" you are doing well. If the response is |
| 80 | "compatible" you are in trouble. You will have to find out why the option is |
| 81 | still set. Perhaps the file you wrote above is not found. Use this command |
| 82 | to find out: > |
| 83 | |
| 84 | :scriptnames |
| 85 | |
| 86 | If your file is not in the list, check its location and name. If it is in the |
| 87 | list, there must be some other place where the 'compatible' option is switched |
| 88 | back on. |
| 89 | |
| 90 | For more info see |vimrc| and |compatible-default|. |
| 91 | |
| 92 | Note: |
| 93 | This manual is about using Vim in the normal way. There is an |
| 94 | alternative called "evim" (easy Vim). This is still Vim, but used in |
| 95 | a way that resembles a click-and-type editor like Notepad. It always |
| 96 | stays in Insert mode, thus it feels very different. It is not |
| 97 | explained in the user manual, since it should be mostly self |
| 98 | explanatory. See |evim-keys| for details. |
| 99 | |
| 100 | ============================================================================== |
| 101 | *01.3* Using the Vim tutor *tutor* *vimtutor* |
| 102 | |
| 103 | Instead of reading the text (boring!) you can use the vimtutor to learn your |
| 104 | first Vim commands. This is a 30 minute tutorial that teaches the most basic |
| 105 | Vim functionality hands-on. |
| 106 | |
Bram Moolenaar | c0197e2 | 2004-09-13 20:26:32 +0000 | [diff] [blame] | 107 | On Unix, if Vim has been properly installed, you can start it from the shell: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 108 | > |
| 109 | vimtutor |
| 110 | |
Bram Moolenaar | c0197e2 | 2004-09-13 20:26:32 +0000 | [diff] [blame] | 111 | On MS-Windows you can find it in the Program/Vim menu. Or execute |
| 112 | vimtutor.bat in the $VIMRUNTIME directory. |
| 113 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 114 | This will make a copy of the tutor file, so that you can edit it without |
| 115 | the risk of damaging the original. |
| 116 | There are a few translated versions of the tutor. To find out if yours is |
| 117 | available, use the two-letter language code. For French: > |
| 118 | |
| 119 | vimtutor fr |
| 120 | |
| 121 | For OpenVMS, if Vim has been properly installed, you can start vimtutor from a |
| 122 | VMS prompt with: > |
| 123 | |
| 124 | @VIM:vimtutor |
| 125 | |
| 126 | Optionally add the two-letter language code as above. |
| 127 | |
| 128 | |
| 129 | On other systems, you have to do a little work: |
| 130 | |
| 131 | 1. Copy the tutor file. You can do this with Vim (it knows where to find it): |
| 132 | > |
| 133 | vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor' -c 'w! TUTORCOPY' -c 'q' |
| 134 | < |
| 135 | This will write the file "TUTORCOPY" in the current directory. To use a |
| 136 | translated version of the tutor, append the two-letter language code to the |
| 137 | filename. For French: |
| 138 | > |
| 139 | vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor.fr' -c 'w! TUTORCOPY' -c 'q' |
| 140 | < |
| 141 | 2. Edit the copied file with Vim: |
| 142 | > |
| 143 | vim -u NONE -c "set nocp" TUTORCOPY |
| 144 | < |
| 145 | The extra arguments make sure Vim is started in a good mood. |
| 146 | |
| 147 | 3. Delete the copied file when you are finished with it: |
| 148 | > |
| 149 | del TUTORCOPY |
| 150 | < |
| 151 | ============================================================================== |
| 152 | *01.4* Copyright *manual-copyright* |
| 153 | |
| 154 | The Vim user manual and reference manual are Copyright (c) 1988-2003 by Bram |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 155 | Moolenaar. This material may be distributed only subject to the terms and |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 156 | conditions set forth in the Open Publication License, v1.0 or later. The |
| 157 | latest version is presently available at: |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 158 | http://www.opencontent.org/openpub/ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 159 | |
| 160 | People who contribute to the manuals must agree with the above copyright |
| 161 | notice. |
| 162 | *frombook* |
| 163 | Parts of the user manual come from the book "Vi IMproved - Vim" by Steve |
| 164 | Oualline (published by New Riders Publishing, ISBN: 0735710015). The Open |
| 165 | Publication License applies to this book. Only selected parts are included |
| 166 | and these have been modified (e.g., by removing the pictures, updating the |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 167 | text for Vim 6.0 and later, fixing mistakes). The omission of the |frombook| |
| 168 | tag does not mean that the text does not come from the book. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 169 | |
| 170 | Many thanks to Steve Oualline and New Riders for creating this book and |
| 171 | publishing it under the OPL! It has been a great help while writing the user |
| 172 | manual. Not only by providing literal text, but also by setting the tone and |
| 173 | style. |
| 174 | |
| 175 | If you make money through selling the manuals, you are strongly encouraged to |
| 176 | donate part of the profit to help AIDS victims in Uganda. See |iccf|. |
| 177 | |
| 178 | ============================================================================== |
| 179 | |
| 180 | Next chapter: |usr_02.txt| The first steps in Vim |
| 181 | |
| 182 | Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: |