Mercurial > vim
annotate runtime/doc/intro.txt @ 17971:cf3bf7a0d3e2
Added tag v8.1.1981 for changeset 684a15da9929c8a50ee56039d1d8c0c21b8b0b12
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 04 Sep 2019 18:00:03 +0200 |
parents | f2c2f9126a82 |
children | c4cdc715cb68 |
rev | line source |
---|---|
17758 | 1 *intro.txt* For Vim version 8.1. Last change: 2019 Aug 16 |
7 | 2 |
3 | |
4 VIM REFERENCE MANUAL by Bram Moolenaar | |
5 | |
6 | |
7 Introduction to Vim *ref* *reference* | |
8 | |
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| | |
16 8. Definitions |definitions| | |
17 | |
18 ============================================================================== | |
19 1. Introduction *intro* | |
20 | |
21 Vim stands for Vi IMproved. It used to be Vi IMitation, but there are so many | |
22 improvements that a name change was appropriate. Vim is a text editor which | |
23 includes almost all the commands from the Unix program "Vi" and a lot of new | |
24 ones. It is very useful for editing programs and other plain text. | |
25 All commands are given with the keyboard. This has the advantage that you | |
26 can keep your fingers on the keyboard and your eyes on the screen. For those | |
27 who want it, there is mouse support and a GUI version with scrollbars and | |
28 menus (see |gui.txt|). | |
29 | |
30 An overview of this manual can be found in the file "help.txt", |help.txt|. | |
31 It can be accessed from within Vim with the <Help> or <F1> key and with the | |
32 |:help| command (just type ":help", without the bars or quotes). | |
33 The 'helpfile' option can be set to the name of the help file, in case it | |
34 is not located in the default place. You can jump to subjects like with tags: | |
35 Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back. | |
36 | |
16553
0e473e9e70c2
patch 8.1.1280: remarks about functionality not in Vi clutters the help
Bram Moolenaar <Bram@vim.org>
parents:
15512
diff
changeset
|
37 The differences between Vi and Vim are mentioned in |vi_diff.txt|. |
7 | 38 |
39 This manual refers to Vim on various machines. There may be small differences | |
40 between different computers and terminals. Besides the remarks given in this | |
41 document, there is a separate document for each supported system, see | |
42 |sys-file-list|. | |
43 | |
2033
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
44 *pronounce* |
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
45 Vim is pronounced as one word, like Jim, not vi-ai-em. It's written with a |
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
46 capital, since it's a name, again like Jim. |
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
47 |
7 | 48 This manual is a reference for all the Vim commands and options. This is not |
49 an introduction to the use of Vi or Vim, it gets a bit complicated here and | |
50 there. For beginners, there is a hands-on |tutor|. To learn using Vim, read | |
51 the user manual |usr_toc.txt|. | |
52 | |
15334 | 53 *book* *books* |
54 Most books on Vi and Vim contain a section for beginners. Others are spending | |
55 more words on specific functionality. You can find an overview of Vim books | |
56 here: | |
57 http://iccf-holland.org/vim_books.html | |
7 | 58 |
59 ============================================================================== | |
60 2. Vim on the internet *internet* | |
61 | |
838 | 62 *www* *WWW* *faq* *FAQ* *distribution* *download* |
7 | 63 The Vim pages contain the most recent information about Vim. They also |
64 contain links to the most recent version of Vim. The FAQ is a list of | |
65 Frequently Asked Questions. Read this if you have problems. | |
66 | |
15334 | 67 Vim home page: https://www.vim.org/ |
17161 | 68 Vim FAQ: https://vimhelp.org/vim_faq.txt.html |
15334 | 69 Downloading: https://www.vim.org/download.php |
7 | 70 |
71 | |
17261 | 72 Asking questions, finding answers: https://vi.stackexchange.com/ |
73 "Vi and Vim Stack Exchange is a question and answer site for people using the | |
74 vi and Vim families of text editors" | |
75 | |
76 | |
7 | 77 Usenet News group where Vim is discussed: *news* *usenet* |
78 comp.editors | |
79 This group is also for other editors. If you write about Vim, don't forget to | |
80 mention that. | |
17261 | 81 You can access it here: |
82 https://groups.google.com/forum/#!topic/comp.editors | |
7 | 83 |
84 *mail-list* *maillist* | |
85 There are several mailing lists for Vim: | |
10548
74effdaa369e
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
86 <vim@vim.org> *vim-use* *vim_use* |
7 | 87 For discussions about using existing versions of Vim: Useful mappings, |
824 | 88 questions, answers, where to get a specific version, etc. There are |
89 quite a few people watching this list and answering questions, also | |
90 for beginners. Don't hesitate to ask your question here. | |
10548
74effdaa369e
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
91 <vim-dev@vim.org> *vim-dev* *vim_dev* *vimdev* |
7 | 92 For discussions about changing Vim: New features, porting, patches, |
93 beta-test versions, etc. | |
10548
74effdaa369e
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
94 <vim-announce@vim.org> *vim-announce* *vim_announce* |
7 | 95 Announcements about new versions of Vim; also for beta-test versions |
824 | 96 and ports to different systems. This is a read-only list. |
10548
74effdaa369e
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
97 <vim-mac@vim.org> *vim-mac* *vim_mac* |
7 | 98 For discussions about using and improving the Macintosh version of |
99 Vim. | |
100 | |
101 See http://www.vim.org/maillist.php for the latest information. | |
102 | |
103 NOTE: | |
15334 | 104 - Anyone can see the archive, e.g. on Google groups. Search this if you have |
105 questions. | |
7 | 106 - You can only send messages to these lists if you have subscribed! |
15334 | 107 - The first message is moderated, thus it may take a few hours to show up. |
7 | 108 - You need to send the messages from the same location as where you subscribed |
109 from (to avoid spam mail). | |
110 | |
111 *subscribe-maillist* | |
112 If you want to join, send a message to | |
1624 | 113 <vim-subscribe@vim.org> |
7 | 114 Make sure that your "From:" address is correct. Then the list server will |
115 give you help on how to subscribe. | |
116 | |
1624 | 117 *maillist-archive* |
118 For more information and archives look on the Vim maillist page: | |
119 http://www.vim.org/maillist.php | |
7 | 120 |
121 | |
122 Bug reports: *bugs* *bug-reports* *bugreport.vim* | |
123 | |
10228
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10198
diff
changeset
|
124 There are two ways to report bugs, both work: |
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10198
diff
changeset
|
125 1. Send bug reports to: Vim Developers <vim-dev@vim.org> |
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10198
diff
changeset
|
126 This is a maillist, you need to become a member first and many people will |
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10198
diff
changeset
|
127 see the message. If you don't want that, e.g. because it is a security |
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10198
diff
changeset
|
128 issue, send it to <bugs@vim.org>, this only goes to the Vim maintainer |
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10198
diff
changeset
|
129 (that's Bram). |
13125 | 130 2. Open an issue on GitHub: https://github.com/vim/vim/issues |
10228
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10198
diff
changeset
|
131 The text will be forwarded to the vim-dev maillist. |
5968 | 132 |
7 | 133 Please be brief; all the time that is spent on answering mail is subtracted |
134 from the time that is spent on improving Vim! Always give a reproducible | |
11763
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11473
diff
changeset
|
135 example and try to find out which settings or other things trigger the bug. |
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11473
diff
changeset
|
136 |
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11473
diff
changeset
|
137 Preferably start Vim with: > |
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11473
diff
changeset
|
138 vim --clean -u reproduce.vim |
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11473
diff
changeset
|
139 Where reproduce.vim is a script that reproduces the problem. Try different |
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11473
diff
changeset
|
140 machines, if relevant (is this an MS-Windows specific bug perhaps?). |
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11473
diff
changeset
|
141 |
15334 | 142 Send me patches if you can! If you create a pull request on |
143 https://github.com/vim/vim then the automated checks will run and report any | |
144 obvious problems. But you can also send the patch by email (use an attachment | |
145 to avoid white space changes). | |
7 | 146 |
502 | 147 It will help to include information about the version of Vim you are using and |
148 your setup. You can get the information with this command: > | |
7 | 149 :so $VIMRUNTIME/bugreport.vim |
150 This will create a file "bugreport.txt" in the current directory, with a lot | |
151 of information of your environment. Before sending this out, check if it | |
152 doesn't contain any confidential information! | |
153 | |
502 | 154 If Vim crashes, please try to find out where. You can find help on this here: |
155 |debug.txt|. | |
7 | 156 |
502 | 157 In case of doubt or when you wonder if the problem has already been fixed but |
158 you can't find a fix for it, become a member of the vim-dev maillist and ask | |
159 your question there. |maillist| | |
7 | 160 |
161 *year-2000* *Y2K* | |
162 Since Vim internally doesn't use dates for editing, there is no year 2000 | |
163 problem to worry about. Vim does use the time in the form of seconds since | |
164 January 1st 1970. It is used for a time-stamp check of the edited file and | |
165 the swap file, which is not critical and should only cause warning messages. | |
166 | |
167 There might be a year 2038 problem, when the seconds don't fit in a 32 bit int | |
168 anymore. This depends on the compiler, libraries and operating system. | |
169 Specifically, time_t and the ctime() function are used. And the time_t is | |
170 stored in four bytes in the swap file. But that's only used for printing a | |
171 file date/time for recovery, it will never affect normal editing. | |
172 | |
173 The Vim strftime() function directly uses the strftime() system function. | |
174 localtime() uses the time() system function. getftime() uses the time | |
175 returned by the stat() system function. If your system libraries are year | |
176 2000 compliant, Vim is too. | |
177 | |
178 The user may create scripts for Vim that use external commands. These might | |
179 introduce Y2K problems, but those are not really part of Vim itself. | |
180 | |
181 ============================================================================== | |
323 | 182 3. Credits *credits* *author* *Bram* *Moolenaar* |
7 | 183 |
15334 | 184 Most of Vim was created by Bram Moolenaar <Bram@vim.org>. |
7 | 185 |
186 Parts of the documentation come from several Vi manuals, written by: | |
187 W.N. Joy | |
188 Alan P.W. Hewett | |
189 Mark Horton | |
190 | |
191 The Vim editor is based on Stevie and includes (ideas from) other software, | |
192 worked on by the people mentioned here. Other people helped by sending me | |
193 patches, suggestions and giving feedback about what is good and bad in Vim. | |
194 | |
195 Vim would never have become what it is now, without the help of these people! | |
196 | |
197 Ron Aaron Win32 GUI changes | |
2246
1e48f569b03d
Move text from various.txt to a new helphelp.txt help file.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
198 Mohsin Ahmed encryption |
7 | 199 Zoltan Arpadffy work on VMS port |
200 Tony Andrews Stevie | |
201 Gert van Antwerpen changes for DJGPP on MS-DOS | |
202 Berkeley DB(3) ideas for swap file implementation | |
203 Keith Bostic Nvi | |
204 Walter Briscoe Makefile updates, various patches | |
205 Ralf Brown SPAWNO library for MS-DOS | |
206 Robert Colon many useful remarks | |
207 Marcin Dalecki GTK+ GUI port, toolbar icons, gettext() | |
208 Kayhan Demirel sent me news in Uganda | |
209 Chris & John Downey xvi (ideas for multi-windows version) | |
210 Henk Elbers first VMS port | |
29 | 211 Daniel Elstner GTK+ 2 port |
7 | 212 Eric Fischer Mac port, 'cindent', and other improvements |
213 Benji Fisher Answering lots of user questions | |
214 Bill Foster Athena GUI port | |
1624 | 215 Google Lets me work on Vim one day a week |
7 | 216 Loic Grenie xvim (ideas for multi windows version) |
1668 | 217 Sven Guckes Vim promoter and previous WWW page maintainer |
7 | 218 Darren Hiebert Exuberant ctags |
29 | 219 Jason Hildebrand GTK+ 2 port |
7 | 220 Bruce Hunsaker improvements for VMS port |
221 Andy Kahn Cscope support, GTK+ GUI port | |
222 Oezguer Kesim Maintainer of Vim Mailing Lists | |
223 Axel Kielhorn work on the Macintosh port | |
224 Steve Kirkendall Elvis | |
225 Roger Knobbe original port to Windows NT | |
226 Sergey Laskavy Vim's help from Moscow | |
1624 | 227 Felix von Leitner Previous maintainer of Vim Mailing Lists |
7 | 228 David Leonard Port of Python extensions to Unix |
229 Avner Lottem Edit in right-to-left windows | |
230 Flemming Madsen X11 client-server, various features and patches | |
2246
1e48f569b03d
Move text from various.txt to a new helphelp.txt help file.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
231 Tony Mechelynck answers many user questions |
7 | 232 Paul Moore Python interface extensions, many patches |
233 Katsuhito Nagano Work on multi-byte versions | |
234 Sung-Hyun Nam Work on multi-byte versions | |
235 Vince Negri Win32 GUI and generic console enhancements | |
236 Steve Oualline Author of the first Vim book |frombook| | |
2246
1e48f569b03d
Move text from various.txt to a new helphelp.txt help file.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
237 Dominique Pelle valgrind reports and many fixes |
1624 | 238 A.Politz Many bug reports and some fixes |
7 | 239 George V. Reilly Win32 port, Win32 GUI start-off |
240 Stephen Riehm bug collector | |
241 Stefan Roemer various patches and help to users | |
242 Ralf Schandl IBM OS/390 port | |
243 Olaf Seibert DICE and BeBox version, regexp improvements | |
244 Mortaza Shiran Farsi patches | |
245 Peter da Silva termlib | |
246 Paul Slootman OS/2 port | |
247 Henry Spencer regular expressions | |
248 Dany St-Amant Macintosh port | |
249 Tim Thompson Stevie | |
250 G. R. (Fred) Walter Stevie | |
251 Sven Verdoolaege Perl interface | |
252 Robert Webb Command-line completion, GUI versions, and | |
253 lots of patches | |
254 Ingo Wilken Tcl interface | |
255 Mike Williams PostScript printing | |
256 Juergen Weigert Lattice version, AUX improvements, UNIX and | |
257 MS-DOS ports, autoconf | |
258 Stefan 'Sec' Zehl Maintainer of vim.org | |
12499 | 259 Yasuhiro Matsumoto many MS-Windows improvements |
260 Ken Takata fixes and features | |
261 Kazunobu Kuriyama GTK 3 | |
262 Christian Brabandt many fixes, features, user support, etc. | |
15334 | 263 Yegappan Lakshmanan many quickfix features |
7 | 264 |
265 I wish to thank all the people that sent me bug reports and suggestions. The | |
266 list is too long to mention them all here. Vim would not be the same without | |
267 the ideas from all these people: They keep Vim alive! | |
4992 | 268 *love* *peace* *friendship* *gross-national-happiness* |
7 | 269 |
270 | |
271 In this documentation there are several references to other versions of Vi: | |
39 | 272 *Vi* *vi* |
7 | 273 Vi "the original". Without further remarks this is the version |
274 of Vi that appeared in Sun OS 4.x. ":version" returns | |
275 "Version 3.7, 6/7/85". Sometimes other versions are referred | |
15512 | 276 to. Only runs under Unix. Source code is now available under a |
277 BSD-style license. More information on Vi can be found through: | |
278 http://ex-vi.sourceforge.net/ | |
7 | 279 *Posix* |
280 Posix From the IEEE standard 1003.2, Part 2: Shell and utilities. | |
281 Generally known as "Posix". This is a textual description of | |
282 how Vi is supposed to work. | |
161 | 283 See |posix-compliance|. |
7 | 284 *Nvi* |
285 Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD. | |
286 Very good compatibility with the original Vi, with a few extensions. | |
287 The version used is 1.79. ":version" returns "Version 1.79 | |
288 (10/23/96)". There has been no release the last few years, although | |
289 there is a development version 1.81. | |
290 Source code is freely available. | |
291 *Elvis* | |
292 Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't | |
15512 | 293 as flexible as Vim. Development has stalled, Elvis has left the |
294 building! Source code is freely available. | |
295 *Neovim* | |
296 Neovim A Vim clone. Forked the Vim source in 2014 and went a different way. | |
15334 | 297 Very much bound to github and has many more dependencies, making |
298 development more complex and limiting portability. Code has been | |
299 refactored, resulting in patches not being exchangeable with Vim. | |
300 Supports a remote GUI and integration with scripting languages. | |
7 | 301 |
302 ============================================================================== | |
303 4. Notation *notation* | |
304 | |
305 When syntax highlighting is used to read this, text that is not typed | |
306 literally is often highlighted with the Special group. These are items in [], | |
307 {} and <>, and CTRL-X. | |
308 | |
309 Note that Vim uses all possible characters in commands. Sometimes the [], {} | |
310 and <> are part of what you type, the context should make this clear. | |
311 | |
312 | |
313 [] Characters in square brackets are optional. | |
314 | |
2596 | 315 *count* *[count]* |
7 | 316 [count] An optional number that may precede the command to multiply |
317 or iterate the command. If no number is given, a count of one | |
318 is used, unless otherwise noted. Note that in this manual the | |
319 [count] is not mentioned in the description of the command, | |
320 but only in the explanation. This was done to make the | |
321 commands easier to look up. If the 'showcmd' option is on, | |
322 the (partially) entered count is shown at the bottom of the | |
323 window. You can use <Del> to erase the last digit (|N<Del>|). | |
324 | |
325 *[quotex]* | |
326 ["x] An optional register designation where text can be stored. | |
327 See |registers|. The x is a single character between 'a' and | |
328 'z' or 'A' and 'Z' or '"', and in some cases (with the put | |
237 | 329 command) between '0' and '9', '%', '#', or others. The |
7 | 330 uppercase and lowercase letter designate the same register, |
331 but the lowercase letter is used to overwrite the previous | |
332 register contents, while the uppercase letter is used to | |
237 | 333 append to the previous register contents. Without the ""x" or |
7 | 334 with """" the stored text is put into the unnamed register. |
335 | |
336 *{}* | |
337 {} Curly braces denote parts of the command which must appear, | |
338 but which can take a number of different values. The | |
339 differences between Vim and Vi are also given in curly braces | |
340 (this will be clear from the context). | |
341 | |
342 *{char1-char2}* | |
343 {char1-char2} A single character from the range char1 to char2. For | |
344 example: {a-z} is a lowercase letter. Multiple ranges may be | |
345 concatenated. For example, {a-zA-Z0-9} is any alphanumeric | |
346 character. | |
347 | |
36 | 348 *{motion}* *movement* |
7 | 349 {motion} A command that moves the cursor. These are explained in |
350 |motion.txt|. Examples: | |
351 w to start of next word | |
352 b to begin of current word | |
353 4j four lines down | |
354 /The<CR> to next occurrence of "The" | |
355 This is used after an |operator| command to move over the text | |
356 that is to be operated upon. | |
357 - If the motion includes a count and the operator also has a | |
358 count, the two counts are multiplied. For example: "2d3w" | |
359 deletes six words. | |
360 - The motion can be backwards, e.g. "db" to delete to the | |
361 start of the word. | |
362 - The motion can also be a mouse click. The mouse is not | |
363 supported in every terminal though. | |
364 - The ":omap" command can be used to map characters while an | |
365 operator is pending. | |
366 - Ex commands can be used to move the cursor. This can be | |
367 used to call a function that does some complicated motion. | |
368 The motion is always characterwise exclusive, no matter | |
369 what ":" command is used. This means it's impossible to | |
370 include the last character of a line without the line break | |
371 (unless 'virtualedit' is set). | |
372 If the Ex command changes the text before where the operator | |
373 starts or jumps to another buffer the result is | |
374 unpredictable. It is possible to change the text further | |
375 down. Jumping to another buffer is possible if the current | |
376 buffer is not unloaded. | |
377 | |
378 *{Visual}* | |
379 {Visual} A selected text area. It is started with the "v", "V", or | |
380 CTRL-V command, then any cursor movement command can be used | |
381 to change the end of the selected text. | |
382 This is used before an |operator| command to highlight the | |
383 text that is to be operated upon. | |
384 See |Visual-mode|. | |
385 | |
386 *<character>* | |
387 <character> A special character from the table below, optionally with | |
388 modifiers, or a single ASCII character with modifiers. | |
389 | |
390 *'character'* | |
391 'c' A single ASCII character. | |
392 | |
393 *CTRL-{char}* | |
394 CTRL-{char} {char} typed as a control character; that is, typing {char} | |
395 while holding the CTRL key down. The case of {char} does not | |
396 matter; thus CTRL-A and CTRL-a are equivalent. But on some | |
397 terminals, using the SHIFT key will produce another code, | |
398 don't use it then. | |
399 | |
400 *'option'* | |
401 'option' An option, or parameter, that can be set to a value, is | |
402 enclosed in single quotes. See |options|. | |
403 | |
404 *quotecommandquote* | |
405 "command" A reference to a command that you can type is enclosed in | |
406 double quotes. | |
4119 | 407 `command` New style command, this distinguishes it from other quoted |
408 text and strings. | |
7 | 409 |
410 *key-notation* *key-codes* *keycodes* | |
411 These names for keys are used in the documentation. They can also be used | |
412 with the ":map" command (insert the key name by pressing CTRL-K and then the | |
413 key you want the name for). | |
414 | |
415 notation meaning equivalent decimal value(s) ~ | |
416 ----------------------------------------------------------------------- | |
417 <Nul> zero CTRL-@ 0 (stored as 10) *<Nul>* | |
418 <BS> backspace CTRL-H 8 *backspace* | |
419 <Tab> tab CTRL-I 9 *tab* *Tab* | |
420 *linefeed* | |
421 <NL> linefeed CTRL-J 10 (used for <Nul>) | |
422 <FF> formfeed CTRL-L 12 *formfeed* | |
423 <CR> carriage return CTRL-M 13 *carriage-return* | |
424 <Return> same as <CR> *<Return>* | |
425 <Enter> same as <CR> *<Enter>* | |
426 <Esc> escape CTRL-[ 27 *escape* *<Esc>* | |
427 <Space> space 32 *space* | |
428 <lt> less-than < 60 *<lt>* | |
429 <Bslash> backslash \ 92 *backslash* *<Bslash>* | |
430 <Bar> vertical bar | 124 *<Bar>* | |
431 <Del> delete 127 | |
432 <CSI> command sequence intro ALT-Esc 155 *<CSI>* | |
433 <xCSI> CSI when typed in the GUI *<xCSI>* | |
434 | |
435 <EOL> end-of-line (can be <CR>, <LF> or <CR><LF>, | |
436 depends on system and 'fileformat') *<EOL>* | |
437 | |
438 <Up> cursor-up *cursor-up* *cursor_up* | |
439 <Down> cursor-down *cursor-down* *cursor_down* | |
440 <Left> cursor-left *cursor-left* *cursor_left* | |
441 <Right> cursor-right *cursor-right* *cursor_right* | |
442 <S-Up> shift-cursor-up | |
443 <S-Down> shift-cursor-down | |
444 <S-Left> shift-cursor-left | |
445 <S-Right> shift-cursor-right | |
446 <C-Left> control-cursor-left | |
447 <C-Right> control-cursor-right | |
448 <F1> - <F12> function keys 1 to 12 *function_key* *function-key* | |
449 <S-F1> - <S-F12> shift-function keys 1 to 12 *<S-F1>* | |
450 <Help> help key | |
451 <Undo> undo key | |
452 <Insert> insert key | |
453 <Home> home *home* | |
454 <End> end *end* | |
455 <PageUp> page-up *page_up* *page-up* | |
456 <PageDown> page-down *page_down* *page-down* | |
457 <kHome> keypad home (upper left) *keypad-home* | |
458 <kEnd> keypad end (lower left) *keypad-end* | |
459 <kPageUp> keypad page-up (upper right) *keypad-page-up* | |
460 <kPageDown> keypad page-down (lower right) *keypad-page-down* | |
461 <kPlus> keypad + *keypad-plus* | |
462 <kMinus> keypad - *keypad-minus* | |
463 <kMultiply> keypad * *keypad-multiply* | |
464 <kDivide> keypad / *keypad-divide* | |
465 <kEnter> keypad Enter *keypad-enter* | |
466 <kPoint> keypad Decimal point *keypad-point* | |
467 <k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9* | |
468 <S-...> shift-key *shift* *<S-* | |
469 <C-...> control-key *control* *ctrl* *<C-* | |
470 <M-...> alt-key or meta-key *meta* *alt* *<M-* | |
471 <A-...> same as <M-...> *<A-* | |
472 <D-...> command-key (Macintosh only) *<D-* | |
473 <t_xx> key with "xx" entry in termcap | |
474 ----------------------------------------------------------------------- | |
475 | |
476 Note: The shifted cursor keys, the help key, and the undo key are only | |
477 available on a few terminals. On the Amiga, shifted function key 10 produces | |
478 a code (CSI) that is also used by key sequences. It will be recognized only | |
479 after typing another key. | |
480 | |
481 Note: There are two codes for the delete key. 127 is the decimal ASCII value | |
482 for the delete key, which is always recognized. Some delete keys send another | |
483 value, in which case this value is obtained from the termcap entry "kD". Both | |
484 values have the same effect. Also see |:fixdel|. | |
485 | |
486 Note: The keypad keys are used in the same way as the corresponding "normal" | |
487 keys. For example, <kHome> has the same effect as <Home>. If a keypad key | |
488 sends the same raw key code as its non-keypad equivalent, it will be | |
489 recognized as the non-keypad code. For example, when <kHome> sends the same | |
490 code as <Home>, when pressing <kHome> Vim will think <Home> was pressed. | |
491 Mapping <kHome> will not work then. | |
492 | |
493 *<>* | |
494 Examples are often given in the <> notation. Sometimes this is just to make | |
495 clear what you need to type, but often it can be typed literally, e.g., with | |
496 the ":map" command. The rules are: | |
497 1. Any printable characters are typed directly, except backslash and '<' | |
498 2. A backslash is represented with "\\", double backslash, or "<Bslash>". | |
499 3. A real '<' is represented with "\<" or "<lt>". When there is no | |
500 confusion possible, a '<' can be used directly. | |
501 4. "<key>" means the special key typed. This is the notation explained in | |
502 the table above. A few examples: | |
503 <Esc> Escape key | |
504 <C-G> CTRL-G | |
505 <Up> cursor up key | |
506 <C-LeftMouse> Control- left mouse click | |
507 <S-F11> Shifted function key 11 | |
508 <M-a> Meta- a ('a' with bit 8 set) | |
509 <M-A> Meta- A ('A' with bit 8 set) | |
510 <t_kd> "kd" termcap entry (cursor down key) | |
17758 | 511 Although you can specify <M-{char}> with {char} being a multi-byte |
512 character, Vim may not be able to know what byte sequence that is and then | |
513 it won't work. | |
7 | 514 |
515 If you want to use the full <> notation in Vim, you have to make sure the '<' | |
516 flag is excluded from 'cpoptions' (when 'compatible' is not set, it already is | |
517 by default). > | |
518 :set cpo-=< | |
519 The <> notation uses <lt> to escape the special meaning of key names. Using a | |
520 backslash also works, but only when 'cpoptions' does not include the 'B' flag. | |
521 | |
522 Examples for mapping CTRL-H to the six characters "<Home>": > | |
523 :imap <C-H> \<Home> | |
524 :imap <C-H> <lt>Home> | |
525 The first one only works when the 'B' flag is not in 'cpoptions'. The second | |
526 one always works. | |
527 To get a literal "<lt>" in a mapping: > | |
528 :map <C-L> <lt>lt> | |
529 | |
530 For mapping, abbreviation and menu commands you can then copy-paste the | |
531 examples and use them directly. Or type them literally, including the '<' and | |
532 '>' characters. This does NOT work for other commands, like ":set" and | |
533 ":autocmd"! | |
534 | |
535 ============================================================================== | |
536 5. Modes, introduction *vim-modes-intro* *vim-modes* | |
537 | |
12045 | 538 Vim has seven BASIC modes: |
7 | 539 |
540 *Normal* *Normal-mode* *command-mode* | |
541 Normal mode In Normal mode you can enter all the normal editor | |
542 commands. If you start the editor you are in this | |
543 mode (unless you have set the 'insertmode' option, | |
544 see below). This is also known as command mode. | |
545 | |
546 Visual mode This is like Normal mode, but the movement commands | |
547 extend a highlighted area. When a non-movement | |
548 command is used, it is executed for the highlighted | |
549 area. See |Visual-mode|. | |
550 If the 'showmode' option is on "-- VISUAL --" is shown | |
551 at the bottom of the window. | |
552 | |
553 Select mode This looks most like the MS-Windows selection mode. | |
554 Typing a printable character deletes the selection | |
555 and starts Insert mode. See |Select-mode|. | |
556 If the 'showmode' option is on "-- SELECT --" is shown | |
557 at the bottom of the window. | |
558 | |
559 Insert mode In Insert mode the text you type is inserted into the | |
560 buffer. See |Insert-mode|. | |
561 If the 'showmode' option is on "-- INSERT --" is shown | |
562 at the bottom of the window. | |
563 | |
564 Command-line mode In Command-line mode (also called Cmdline mode) you | |
565 Cmdline mode can enter one line of text at the bottom of the | |
566 window. This is for the Ex commands, ":", the pattern | |
567 search commands, "?" and "/", and the filter command, | |
568 "!". |Cmdline-mode| | |
569 | |
570 Ex mode Like Command-line mode, but after entering a command | |
571 you remain in Ex mode. Very limited editing of the | |
572 command line. |Ex-mode| | |
573 | |
12045 | 574 Terminal-Job mode Interacting with a job in a terminal window. Typed |
575 keys go to the job and the job output is displayed in | |
576 the terminal window. See |terminal| about how to | |
577 switch to other modes. | |
578 | |
11914 | 579 There are seven ADDITIONAL modes. These are variants of the BASIC modes: |
7 | 580 |
581 *Operator-pending* *Operator-pending-mode* | |
582 Operator-pending mode This is like Normal mode, but after an operator | |
583 command has started, and Vim is waiting for a {motion} | |
584 to specify the text that the operator will work on. | |
585 | |
586 Replace mode Replace mode is a special case of Insert mode. You | |
587 can do the same things as in Insert mode, but for | |
588 each character you enter, one character of the existing | |
589 text is deleted. See |Replace-mode|. | |
590 If the 'showmode' option is on "-- REPLACE --" is | |
591 shown at the bottom of the window. | |
592 | |
1624 | 593 Virtual Replace mode Virtual Replace mode is similar to Replace mode, but |
594 instead of file characters you are replacing screen | |
595 real estate. See |Virtual-Replace-mode|. | |
596 If the 'showmode' option is on "-- VREPLACE --" is | |
597 shown at the bottom of the window. | |
598 | |
14519 | 599 Insert Normal mode Entered when CTRL-O is typed in Insert mode (see |
600 |i_CTRL-O|). This is like Normal mode, but after | |
601 executing one command Vim returns to Insert mode. | |
7 | 602 If the 'showmode' option is on "-- (insert) --" is |
603 shown at the bottom of the window. | |
604 | |
12045 | 605 Terminal-Normal mode Using Normal mode in a terminal window. Making |
606 changes is impossible. Use an insert command, such as | |
607 "a" or "i", to return to Terminal-Job mode. | |
11914 | 608 |
7 | 609 Insert Visual mode Entered when starting a Visual selection from Insert |
610 mode, e.g., by using CTRL-O and then "v", "V" or | |
611 CTRL-V. When the Visual selection ends, Vim returns | |
612 to Insert mode. | |
613 If the 'showmode' option is on "-- (insert) VISUAL --" | |
614 is shown at the bottom of the window. | |
615 | |
616 Insert Select mode Entered when starting Select mode from Insert mode. | |
617 E.g., by dragging the mouse or <S-Right>. | |
618 When the Select mode ends, Vim returns to Insert mode. | |
619 If the 'showmode' option is on "-- (insert) SELECT --" | |
620 is shown at the bottom of the window. | |
621 | |
622 ============================================================================== | |
623 6. Switching from mode to mode *mode-switching* | |
624 | |
625 If for any reason you do not know which mode you are in, you can always get | |
626 back to Normal mode by typing <Esc> twice. This doesn't work for Ex mode | |
627 though, use ":visual". | |
628 You will know you are back in Normal mode when you see the screen flash or | |
629 hear the bell after you type <Esc>. However, when pressing <Esc> after using | |
630 CTRL-O in Insert mode you get a beep but you are still in Insert mode, type | |
631 <Esc> again. | |
632 | |
633 *i_esc* | |
634 TO mode ~ | |
635 Normal Visual Select Insert Replace Cmd-line Ex ~ | |
636 FROM mode ~ | |
1624 | 637 Normal v V ^V *4 *1 R gR : / ? ! Q |
7 | 638 Visual *2 ^G c C -- : -- |
639 Select *5 ^O ^G *6 -- -- -- | |
640 Insert <Esc> -- -- <Insert> -- -- | |
641 Replace <Esc> -- -- <Insert> -- -- | |
642 Command-line *3 -- -- :start -- -- | |
643 Ex :vi -- -- -- -- -- | |
644 | |
645 -- not possible | |
646 | |
647 *1 Go from Normal mode to Insert mode by giving the command "i", "I", "a", | |
648 "A", "o", "O", "c", "C", "s" or S". | |
649 *2 Go from Visual mode to Normal mode by giving a non-movement command, which | |
650 causes the command to be executed, or by hitting <Esc> "v", "V" or "CTRL-V" | |
651 (see |v_v|), which just stops Visual mode without side effects. | |
652 *3 Go from Command-line mode to Normal mode by: | |
653 - Hitting <CR> or <NL>, which causes the entered command to be executed. | |
654 - Deleting the complete line (e.g., with CTRL-U) and giving a final <BS>. | |
655 - Hitting CTRL-C or <Esc>, which quits the command-line without executing | |
656 the command. | |
657 In the last case <Esc> may be the character defined with the 'wildchar' | |
658 option, in which case it will start command-line completion. You can | |
16610 | 659 ignore that and type <Esc> again. |
7 | 660 *4 Go from Normal to Select mode by: |
661 - use the mouse to select text while 'selectmode' contains "mouse" | |
662 - use a non-printable command to move the cursor while keeping the Shift | |
663 key pressed, and the 'selectmode' option contains "key" | |
664 - use "v", "V" or "CTRL-V" while 'selectmode' contains "cmd" | |
665 - use "gh", "gH" or "g CTRL-H" |g_CTRL-H| | |
666 *5 Go from Select mode to Normal mode by using a non-printable command to move | |
667 the cursor, without keeping the Shift key pressed. | |
668 *6 Go from Select mode to Insert mode by typing a printable character. The | |
669 selection is deleted and the character is inserted. | |
670 | |
671 If the 'insertmode' option is on, editing a file will start in Insert mode. | |
672 | |
673 *CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N* | |
674 Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go to | |
675 Normal mode from any other mode. This can be used to make sure Vim is in | |
676 Normal mode, without causing a beep like <Esc> would. However, this does not | |
677 work in Ex mode. When used after a command that takes an argument, such as | |
678 |f| or |m|, the timeout set with 'ttimeoutlen' applies. | |
12045 | 679 When focus is in a terminal window, CTRL-\ CTRL-N goes to Normal mode for only |
680 one command, see |t_CTRL-\_CTRL-N|. | |
7 | 681 |
682 *CTRL-\_CTRL-G* *i_CTRL-\_CTRL-G* *c_CTRL-\_CTRL-G* *v_CTRL-\_CTRL-G* | |
683 The command CTRL-\ CTRL-G or <C-\><C-G> can be used to go to Insert mode when | |
684 'insertmode' is set. Otherwise it goes to Normal mode. This can be used to | |
685 make sure Vim is in the mode indicated by 'insertmode', without knowing in | |
686 what mode Vim currently is. | |
687 | |
688 *Q* *mode-Ex* *Ex-mode* *Ex* *EX* *E501* | |
689 Q Switch to "Ex" mode. This is a bit like typing ":" | |
690 commands one after another, except: | |
691 - You don't have to keep pressing ":". | |
692 - The screen doesn't get updated after each command. | |
693 - There is no normal command-line editing. | |
694 - Mappings and abbreviations are not used. | |
695 In fact, you are editing the lines with the "standard" | |
696 line-input editing commands (<Del> or <BS> to erase, | |
697 CTRL-U to kill the whole line). | |
698 Vim will enter this mode by default if it's invoked as | |
699 "ex" on the command-line. | |
700 Use the ":vi" command |:visual| to exit "Ex" mode. | |
701 Note: In older versions of Vim "Q" formatted text, | |
702 that is now done with |gq|. But if you use the | |
703 |vimrc_example.vim| script "Q" works like "gq". | |
704 | |
705 *gQ* | |
161 | 706 gQ Switch to "Ex" mode like with "Q", but really behave |
707 like typing ":" commands after another. All command | |
708 line editing, completion etc. is available. | |
7 | 709 Use the ":vi" command |:visual| to exit "Ex" mode. |
710 | |
711 ============================================================================== | |
712 7. The window contents *window-contents* | |
713 | |
714 In Normal mode and Insert/Replace mode the screen window will show the current | |
715 contents of the buffer: What You See Is What You Get. There are two | |
716 exceptions: | |
717 - When the 'cpoptions' option contains '$', and the change is within one line, | |
718 the text is not directly deleted, but a '$' is put at the last deleted | |
719 character. | |
720 - When inserting text in one window, other windows on the same text are not | |
721 updated until the insert is finished. | |
722 | |
723 Lines longer than the window width will wrap, unless the 'wrap' option is off | |
724 (see below). The 'linebreak' option can be set to wrap at a blank character. | |
725 | |
726 If the window has room after the last line of the buffer, Vim will show '~' in | |
2642 | 727 the first column of the last lines in the window, like this: |
7 | 728 |
729 +-----------------------+ | |
730 |some line | | |
731 |last line | | |
732 |~ | | |
733 |~ | | |
734 +-----------------------+ | |
735 | |
736 Thus the '~' lines indicate that the end of the buffer was reached. | |
737 | |
738 If the last line in a window doesn't fit, Vim will indicate this with a '@' in | |
2642 | 739 the first column of the last lines in the window, like this: |
7 | 740 |
741 +-----------------------+ | |
742 |first line | | |
743 |second line | | |
744 |@ | | |
745 |@ | | |
746 +-----------------------+ | |
747 | |
748 Thus the '@' lines indicate that there is a line that doesn't fit in the | |
749 window. | |
750 | |
751 When the "lastline" flag is present in the 'display' option, you will not see | |
752 '@' characters at the left side of window. If the last line doesn't fit | |
753 completely, only the part that fits is shown, and the last three characters of | |
2662 | 754 the last line are replaced with "@@@", like this: |
7 | 755 |
756 +-----------------------+ | |
757 |first line | | |
758 |second line | | |
759 |a very long line that d| | |
760 |oesn't fit in the wi@@@| | |
761 +-----------------------+ | |
762 | |
763 If there is a single line that is too long to fit in the window, this is a | |
764 special situation. Vim will show only part of the line, around where the | |
765 cursor is. There are no special characters shown, so that you can edit all | |
766 parts of this line. | |
767 | |
768 The '@' occasion in the 'highlight' option can be used to set special | |
769 highlighting for the '@' and '~' characters. This makes it possible to | |
770 distinguish them from real characters in the buffer. | |
771 | |
772 The 'showbreak' option contains the string to put in front of wrapped lines. | |
773 | |
774 *wrap-off* | |
775 If the 'wrap' option is off, long lines will not wrap. Only the part that | |
776 fits on the screen is shown. If the cursor is moved to a part of the line | |
777 that is not shown, the screen is scrolled horizontally. The advantage of | |
778 this method is that columns are shown as they are and lines that cannot fit | |
779 on the screen can be edited. The disadvantage is that you cannot see all the | |
780 characters of a line at once. The 'sidescroll' option can be set to the | |
16610 | 781 minimal number of columns to scroll. |
7 | 782 |
783 All normal ASCII characters are displayed directly on the screen. The <Tab> | |
784 is replaced with the number of spaces that it represents. Other non-printing | |
785 characters are replaced with "^{char}", where {char} is the non-printing | |
786 character with 64 added. Thus character 7 (bell) will be shown as "^G". | |
787 Characters between 127 and 160 are replaced with "~{char}", where {char} is | |
788 the character with 64 subtracted. These characters occupy more than one | |
789 position on the screen. The cursor can only be positioned on the first one. | |
790 | |
791 If you set the 'number' option, all lines will be preceded with their | |
792 number. Tip: If you don't like wrapping lines to mix with the line numbers, | |
793 set the 'showbreak' option to eight spaces: | |
794 ":set showbreak=\ \ \ \ \ \ \ \ " | |
795 | |
796 If you set the 'list' option, <Tab> characters will not be shown as several | |
797 spaces, but as "^I". A '$' will be placed at the end of the line, so you can | |
798 find trailing blanks. | |
799 | |
800 In Command-line mode only the command-line itself is shown correctly. The | |
801 display of the buffer contents is updated as soon as you go back to Command | |
802 mode. | |
803 | |
804 The last line of the window is used for status and other messages. The | |
805 status messages will only be used if an option is on: | |
806 | |
807 status message option default Unix default ~ | |
808 current mode 'showmode' on on | |
809 command characters 'showcmd' on off | |
810 cursor position 'ruler' off off | |
811 | |
812 The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|. The | |
16610 | 813 command characters are those that you typed but were not used yet. |
7 | 814 |
815 If you have a slow terminal you can switch off the status messages to speed | |
816 up editing: | |
817 :set nosc noru nosm | |
818 | |
819 If there is an error, an error message will be shown for at least one second | |
16610 | 820 (in reverse video). |
7 | 821 |
822 Some commands show how many lines were affected. Above which threshold this | |
823 happens can be controlled with the 'report' option (default 2). | |
824 | |
825 On the Amiga Vim will run in a CLI window. The name Vim and the full name of | |
826 the current file name will be shown in the title bar. When the window is | |
827 resized, Vim will automatically redraw the window. You may make the window as | |
828 small as you like, but if it gets too small not a single line will fit in it. | |
829 Make it at least 40 characters wide to be able to read most messages on the | |
830 last line. | |
831 | |
832 On most Unix systems, resizing the window is recognized and handled correctly | |
16610 | 833 by Vim. |
7 | 834 |
835 ============================================================================== | |
836 8. Definitions *definitions* | |
837 | |
12254 | 838 buffer Contains lines of text, usually read from a file. |
7 | 839 screen The whole area that Vim uses to work in. This can be |
840 a terminal emulator window. Also called "the Vim | |
841 window". | |
12254 | 842 window A view on a buffer. There can be multiple windows for |
843 one buffer. | |
7 | 844 |
845 A screen contains one or more windows, separated by status lines and with the | |
846 command line at the bottom. | |
847 | |
848 +-------------------------------+ | |
849 screen | window 1 | window 2 | | |
850 | | | | |
851 | | | | |
852 |= status line =|= status line =| | |
853 | window 3 | | |
854 | | | |
855 | | | |
856 |==== status line ==============| | |
857 |command line | | |
858 +-------------------------------+ | |
859 | |
860 The command line is also used for messages. It scrolls up the screen when | |
861 there is not enough room in the command line. | |
862 | |
863 A difference is made between four types of lines: | |
864 | |
865 buffer lines The lines in the buffer. This is the same as the | |
866 lines as they are read from/written to a file. They | |
867 can be thousands of characters long. | |
868 logical lines The buffer lines with folding applied. Buffer lines | |
869 in a closed fold are changed to a single logical line: | |
870 "+-- 99 lines folded". They can be thousands of | |
871 characters long. | |
872 window lines The lines displayed in a window: A range of logical | |
873 lines with wrapping, line breaks, etc. applied. They | |
874 can only be as long as the width of the window allows, | |
875 longer lines are wrapped or truncated. | |
876 screen lines The lines of the screen that Vim uses. Consists of | |
877 the window lines of all windows, with status lines | |
878 and the command line added. They can only be as long | |
879 as the width of the screen allows. When the command | |
880 line gets longer it wraps and lines are scrolled to | |
881 make room. | |
882 | |
883 buffer lines logical lines window lines screen lines ~ | |
884 | |
885 1. one 1. one 1. +-- folded 1. +-- folded | |
886 2. two 2. +-- folded 2. five 2. five | |
887 3. three 3. five 3. six 3. six | |
888 4. four 4. six 4. seven 4. seven | |
889 5. five 5. seven 5. === status line === | |
890 6. six 6. aaa | |
891 7. seven 7. bbb | |
892 8. ccc ccc c | |
893 1. aaa 1. aaa 1. aaa 9. cc | |
894 2. bbb 2. bbb 2. bbb 10. ddd | |
895 3. ccc ccc ccc 3. ccc ccc ccc 3. ccc ccc c 11. ~ | |
896 4. ddd 4. ddd 4. cc 12. === status line === | |
897 5. ddd 13. (command line) | |
898 6. ~ | |
899 | |
900 ============================================================================== | |
14421 | 901 vim:tw=78:ts=8:noet:ft=help:norl: |