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