blob: 9902691badb8f2e46188fe97502b4840bfb64da7 [file] [log] [blame]
Yegappan Lakshmanana54816b2024-11-03 10:49:23 +01001*usr_01.txt* For Vim version 9.1. Last change: 2024 Nov 03
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3 VIM USER MANUAL - by Bram Moolenaar
4
5 About the manuals
6
7
8This chapter introduces the manuals available with Vim. Read this to know the
9conditions 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
17Table of contents: |usr_toc.txt|
18
19==============================================================================
20*01.1* Two manuals
21
22The Vim documentation consists of two parts:
23
241. The User manual
25 Task oriented explanations, from simple to complex. Reads from start to
26 end like a book.
27
282. The Reference manual
29 Precise description of how everything in Vim works.
30
31The notation used in these manuals is explained here: |notation|
32
33
34JUMPING AROUND
35
36The text contains hyperlinks between the two parts, allowing you to quickly
37jump between the description of an editing task and a precise explanation of
38the 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
Bram Moolenaar166af9b2010-11-16 20:34:40 +010043Many links are in vertical bars, like this: |bars|. The bars themselves may
Bram Moolenaar0c0734d2019-11-26 21:44:46 +010044be hidden or invisible; see below. An option name, like 'number', a command
Bram Moolenaar166af9b2010-11-16 20:34:40 +010045in double quotes like ":write" and any other word can also be used as a link.
46Try it out: Move the cursor to CTRL-] and press CTRL-] on it.
Bram Moolenaar071d4272004-06-13 20:20:40 +000047
Bram Moolenaar0c0734d2019-11-26 21:44:46 +010048Other subjects can be found with the ":help" command; see |help.txt|.
Bram Moolenaar071d4272004-06-13 20:20:40 +000049
Bram Moolenaar166af9b2010-11-16 20:34:40 +010050The bars and stars are usually hidden with the |conceal| feature. They also
51use |hl-Ignore|, using the same color for the text as the background. You can
52make them visible with: >
53 :set conceallevel=0
54 :hi link HelpBar Normal
55 :hi link HelpStar Normal
56
Bram Moolenaar071d4272004-06-13 20:20:40 +000057==============================================================================
58*01.2* Vim installed
59
60Most of the manuals assume that Vim has been properly installed. If you
61didn't do that yet, or if Vim doesn't run properly (e.g., files can't be found
62or in the GUI the menus do not show up) first read the chapter on
63installation: |usr_90.txt|.
64 *not-compatible*
65The manuals often assume you are using Vim with Vi-compatibility switched
66off. For most commands this doesn't matter, but sometimes it is important,
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000067e.g., for multi-level undo. An easy way to make sure you are using a nice
68setup is to copy the example vimrc file. By doing this inside Vim you don't
69have to check out where it is located. How to do this depends on the system
70you are using:
Bram Moolenaar071d4272004-06-13 20:20:40 +000071
72Unix: >
73 :!cp -i $VIMRUNTIME/vimrc_example.vim ~/.vimrc
Bram Moolenaar6f345a12019-12-17 21:27:18 +010074MS-Windows: >
Bram Moolenaar071d4272004-06-13 20:20:40 +000075 :!copy $VIMRUNTIME/vimrc_example.vim $VIM/_vimrc
76Amiga: >
77 :!copy $VIMRUNTIME/vimrc_example.vim $VIM/.vimrc
78
79If the file already exists you probably want to keep it.
80
81If you start Vim now, the 'compatible' option should be off. You can check it
82with this command: >
83
84 :set compatible?
85
86If it responds with "nocompatible" you are doing well. If the response is
87"compatible" you are in trouble. You will have to find out why the option is
88still set. Perhaps the file you wrote above is not found. Use this command
89to find out: >
90
91 :scriptnames
92
93If your file is not in the list, check its location and name. If it is in the
94list, there must be some other place where the 'compatible' option is switched
95back on.
96
97For more info see |vimrc| and |compatible-default|.
98
99 Note:
100 This manual is about using Vim in the normal way. There is an
101 alternative called "evim" (easy Vim). This is still Vim, but used in
102 a way that resembles a click-and-type editor like Notepad. It always
103 stays in Insert mode, thus it feels very different. It is not
Bram Moolenaar0c0734d2019-11-26 21:44:46 +0100104 explained in the user manual, since it should be mostly
105 self-explanatory. See |evim-keys| for details.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000106
107==============================================================================
108*01.3* Using the Vim tutor *tutor* *vimtutor*
109
Yegappan Lakshmanana54816b2024-11-03 10:49:23 +0100110For the interactive tutor, see |vim-tutor-mode|
111
Bram Moolenaar071d4272004-06-13 20:20:40 +0000112Instead of reading the text (boring!) you can use the vimtutor to learn your
Bram Moolenaar0c0734d2019-11-26 21:44:46 +0100113first Vim commands. This is a 30-minute tutorial that teaches the most basic
Bram Moolenaar071d4272004-06-13 20:20:40 +0000114Vim functionality hands-on.
115
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000116On Unix, if Vim has been properly installed, you can start it from the shell:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000117>
118 vimtutor
119
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000120On MS-Windows you can find it in the Program/Vim menu. Or execute
121vimtutor.bat in the $VIMRUNTIME directory.
122
Bram Moolenaar071d4272004-06-13 20:20:40 +0000123This will make a copy of the tutor file, so that you can edit it without
124the risk of damaging the original.
125 There are a few translated versions of the tutor. To find out if yours is
126available, use the two-letter language code. For French: >
127
128 vimtutor fr
129
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000130On Unix, if you prefer using the GUI version of Vim, use "gvimtutor" or
131"vimtutor -g" instead of "vimtutor".
132
Bram Moolenaar071d4272004-06-13 20:20:40 +0000133For OpenVMS, if Vim has been properly installed, you can start vimtutor from a
134VMS prompt with: >
135
136 @VIM:vimtutor
137
138Optionally add the two-letter language code as above.
139
140
141On other systems, you have to do a little work:
142
1431. Copy the tutor file. You can do this with Vim (it knows where to find it):
144>
Bram Moolenaarc4da1132017-07-15 19:39:43 +0200145 vim --clean -c 'e $VIMRUNTIME/tutor/tutor' -c 'w! TUTORCOPY' -c 'q'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000146<
147 This will write the file "TUTORCOPY" in the current directory. To use a
148translated version of the tutor, append the two-letter language code to the
149filename. For French:
150>
Bram Moolenaarc4da1132017-07-15 19:39:43 +0200151 vim --clean -c 'e $VIMRUNTIME/tutor/tutor.fr' -c 'w! TUTORCOPY' -c 'q'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000152<
1532. Edit the copied file with Vim:
154>
Bram Moolenaarc4da1132017-07-15 19:39:43 +0200155 vim --clean TUTORCOPY
Bram Moolenaar071d4272004-06-13 20:20:40 +0000156<
Bram Moolenaarc4da1132017-07-15 19:39:43 +0200157 The --clean argument makes sure Vim is started with nice defaults.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000158
1593. Delete the copied file when you are finished with it:
160>
161 del TUTORCOPY
162<
163==============================================================================
164*01.4* Copyright *manual-copyright*
165
Bram Moolenaarb7398fe2023-05-14 18:50:25 +0100166The Vim user manual and reference manual are Copyright (c) 1988 by Bram
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000167Moolenaar. This material may be distributed only subject to the terms and
Bram Moolenaar071d4272004-06-13 20:20:40 +0000168conditions set forth in the Open Publication License, v1.0 or later. The
169latest version is presently available at:
Christian Brabandt1c5728e2024-05-11 11:12:40 +0200170 https://opencontent.org/openpub/
Bram Moolenaar071d4272004-06-13 20:20:40 +0000171
172People who contribute to the manuals must agree with the above copyright
173notice.
174 *frombook*
175Parts of the user manual come from the book "Vi IMproved - Vim" by Steve
176Oualline (published by New Riders Publishing, ISBN: 0735710015). The Open
177Publication License applies to this book. Only selected parts are included
178and these have been modified (e.g., by removing the pictures, updating the
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000179text for Vim 6.0 and later, fixing mistakes). The omission of the |frombook|
180tag does not mean that the text does not come from the book.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000181
182Many thanks to Steve Oualline and New Riders for creating this book and
183publishing it under the OPL! It has been a great help while writing the user
184manual. Not only by providing literal text, but also by setting the tone and
185style.
186
187If you make money through selling the manuals, you are strongly encouraged to
188donate part of the profit to help AIDS victims in Uganda. See |iccf|.
189
190==============================================================================
191
192Next chapter: |usr_02.txt| The first steps in Vim
193
Bram Moolenaard473c8c2018-08-11 18:00:22 +0200194Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl: