1
- *usr_04.txt* For Vim version 8.1 . Last change: 2014 Aug 29
1
+ *usr_04.txt* For Vim version 8.2 . Last change: 2019 Nov 21
2
2
3
3
VIM USER MANUAL - by Bram Moolenaar
4
4
@@ -33,7 +33,7 @@ using a count: "4x" deletes four characters.
33
33
move word command. In fact, the "d" command may be followed by any motion
34
34
command, and it deletes from the current location to the place where the
35
35
cursor winds up.
36
- The "4w" command, for example, moves the cursor over four words. The d4w
36
+ The "4w" command, for example, moves the cursor over four words. The " d4w"
37
37
command deletes four words.
38
38
39
39
To err is human. To really foul up you need a computer. ~
@@ -91,14 +91,14 @@ This "c2wbe<Esc>" contains these bits:
91
91
be insert this text
92
92
<Esc> back to Normal mode
93
93
94
- If you have paid attention, you will have noticed something strange: The space
95
- before "human" isn't deleted. There is a saying that for every problem there
96
- is an answer that is simple, clear, and wrong. That is the case with the
97
- example used here for the "cw" command. The c operator works just like the
98
- d operator, with one exception: "cw". It actually works like "ce", change to
99
- end of word. Thus the space after the word isn't included. This is an
100
- exception that dates back to the old Vi. Since many people are used to it
101
- now, the inconsistency has remained in Vim.
94
+ You will have noticed something strange: The space before "human" isn't
95
+ deleted. There is a saying that for every problem there is an answer that is
96
+ simple, clear, and wrong. That is the case with the example used here for the
97
+ "cw" command. The c operator works just like the d operator, with one
98
+ exception: "cw". It actually works like "ce", change to end of word. Thus
99
+ the space after the word isn't included. This is an exception that dates back
100
+ to the old Vi. Since many people are used to it now, the inconsistency has
101
+ remained in Vim.
102
102
103
103
104
104
MORE CHANGES
@@ -114,7 +114,7 @@ Insert mode and append new text.
114
114
SHORTCUTS
115
115
116
116
Some operator-motion commands are used so often that they have been given a
117
- single letter command:
117
+ single- letter command:
118
118
119
119
x stands for dl (delete character under the cursor)
120
120
X stands for dh (delete character left of the cursor)
@@ -138,6 +138,7 @@ REPLACING WITH ONE CHARACTER
138
138
The "r" command is not an operator. It waits for you to type a character, and
139
139
will replace the character under the cursor with it. You could do the same
140
140
with "cl" or with the "s" command, but with "r" you don't have to press <Esc>
141
+ to get back out of insert mode.
141
142
142
143
there is somerhing grong here ~
143
144
rT rt rw
@@ -164,7 +165,7 @@ The "." command is one of the most simple yet powerful commands in Vim. It
164
165
repeats the last change. For instance, suppose you are editing an HTML file
165
166
and want to delete all the <B> tags. You position the cursor on the first <
166
167
and delete the <B> with the command "df>". You then go to the < of the next
167
- </B> and kill it using the "." command. The "." command executes the last
168
+ </B> and delete it using the "." command. The "." command executes the last
168
169
change command (in this case, "df>"). To delete another tag, position the
169
170
cursor on the < and use the "." command.
170
171
@@ -176,8 +177,8 @@ cursor on the < and use the "." command.
176
177
f< find next < ------------->
177
178
. repeat df> -->
178
179
179
- The "." command works for all changes you make, except for the "u" (undo),
180
- CTRL-R (redo) and commands that start with a colon (:).
180
+ The "." command works for all changes you make, except for "u" (undo), CTRL-R
181
+ (redo) and commands that start with a colon (:).
181
182
182
183
Another example: You want to change the word "four" to "five". It appears
183
184
several times in your text. You can do this quickly with this sequence of
@@ -201,7 +202,8 @@ change. Then you can use Visual mode.
201
202
You start Visual mode by pressing "v". You move the cursor over the text you
202
203
want to work on. While you do this, the text is highlighted. Finally type
203
204
the operator command.
204
- For example, to delete from halfway one word to halfway another word:
205
+ For example, to delete from the middle of one word to the middle of another
206
+ word:
205
207
206
208
This is an examination sample of visual mode ~
207
209
---------->
@@ -269,8 +271,8 @@ where they open a new line below or above the cursor.
269
271
==============================================================================
270
272
*04.5* Moving text
271
273
272
- When you delete something with the "d", "x", or another command, the text is
273
- saved. You can paste it back by using the p command. (The Vim name for
274
+ When you delete something with "d", "x", or another command, the text is
275
+ saved. You can paste it back by using the "p" command. (The Vim name for
274
276
this is put).
275
277
Take a look at how this works. First you will delete an entire line, by
276
278
putting the cursor on the line you want to delete and typing "dd". Now you
@@ -362,11 +364,11 @@ Use "y$" to yank to the end of the line.
362
364
363
365
If you are using the GUI version of Vim (gvim), you can find the "Copy" item
364
366
in the "Edit" menu. First select some text with Visual mode, then use the
365
- Edit/Copy menu. The selected text is now copied to the clipboard. You can
366
- paste the text in other programs. In Vim itself too.
367
+ Edit/Copy menu item . The selected text is now copied to the clipboard. You
368
+ can paste the text in other programs. In Vim itself too.
367
369
368
370
If you have copied text to the clipboard in another application, you can paste
369
- it in Vim with the Edit/Paste menu. This works in Normal mode and Insert
371
+ it in Vim with the Edit/Paste menu item . This works in Normal mode and Insert
370
372
mode. In Visual mode the selected text is replaced with the pasted text.
371
373
372
374
The "Cut" menu item deletes the text before it's put on the clipboard. The
@@ -385,7 +387,7 @@ To put text from the clipboard back into the text: >
385
387
"*p
386
388
387
389
This only works on versions of Vim that include clipboard support. More about
388
- the clipboard in section | 09.3 | and here: | clipboard | .
390
+ the clipboard can be found in section | 09.3 | and here: | clipboard | .
389
391
390
392
==============================================================================
391
393
*04.8* Text objects
@@ -401,8 +403,8 @@ to do this: "daw".
401
403
402
404
The "d" of "daw" is the delete operator. "aw" is a text object. Hint: "aw"
403
405
stands for "A Word". Thus "daw" is "Delete A Word". To be precise, the white
404
- space after the word is also deleted (the white space before the word at the
405
- end of the line).
406
+ space after the word is also deleted (or the white space before the word if at
407
+ the end of the line).
406
408
407
409
Using text objects is the third way to make changes in Vim. We already had
408
410
operator-motion and Visual mode. Now we add operator-text object.
@@ -429,11 +431,11 @@ sentence "Another line.":
429
431
some text. ~
430
432
431
433
"cis" consists of the "c" (change) operator and the "is" text object. This
432
- stands for "Inner Sentence". There is also the "as" (a sentence ) object. The
433
- difference is that "as" includes the white space after the sentence and "is"
434
- doesn't. If you would delete a sentence, you want to delete the white space
435
- at the same time, thus use "das". If you want to type new text the white
436
- space can remain, thus you use "cis".
434
+ stands for "Inner Sentence". There is also the "as" ("A Sentence" ) object.
435
+ The difference is that "as" includes the white space after the sentence and
436
+ "is" doesn't. If you would delete a sentence, you want to delete the white
437
+ space at the same time, thus use "das". If you want to type new text the
438
+ white space can remain, thus you use "cis".
437
439
438
440
You can also use text objects in Visual mode. It will include the text object
439
441
in the Visual selection. Visual mode continues, thus you can do this several
@@ -470,13 +472,13 @@ character.
470
472
*04.10* Conclusion
471
473
472
474
The operators, movement commands and text objects give you the possibility to
473
- make lots of combinations. Now that you know how it works , you can use N
475
+ make lots of combinations. Now that you know how they work , you can use N
474
476
operators with M movement commands to make N * M commands!
475
477
476
- You can find a list of operators here: | operator |
478
+ You can find a list of operators here: | operator | .
477
479
478
480
For example, there are many other ways to delete pieces of text. Here are a
479
- few often used ones:
481
+ few common ones:
480
482
481
483
x delete character under the cursor (short for "dl")
482
484
X delete character before the cursor (short for "dh")
@@ -492,14 +494,14 @@ If you use "c" instead of "d" they become change commands. And with "y" you
492
494
yank the text. And so forth.
493
495
494
496
495
- There are a few often used commands to make changes that didn't fit somewhere
497
+ There are a few common commands to make changes that didn't fit somewhere
496
498
else:
497
499
498
- ~ change case of the character under the cursor, and move the
500
+ ~ Change case of the character under the cursor, and move the
499
501
cursor to the next character. This is not an operator (unless
500
502
'tildeop' is set), thus you can't use it with a motion
501
- command. It does work in Visual mode and changes case for
502
- all the selected text then .
503
+ command. It does work in Visual mode, where it changes case
504
+ for all the selected text.
503
505
504
506
I Start Insert mode after moving the cursor to the first
505
507
non-blank in the line.
0 commit comments