Vim Tutor
VIM Tutor
Press x
to delete the character under the cursor.
Press x
to delete the character under the cursor.
To fix the errors, move the cursor until it is on top of the character to be deleted.
Then, Press the
x
key to delete the unwanted character
Press A
to append text.
Move the cursor to the line in which you append text. Press A
and type in the necessary additions.
It does not matter on what character the cursor is in that line.
Type dw
to delete a word.
Move the cursor to the beginning of a word that needs to be deleted. Then, Type dw
to make the word disappear.
The letter d will appear on the last line of the screen as you type it. Vim is waiting for you to type w . If you see another character than d you typed something wrong; press
and start over.
Type d$
to delete to the end of the line.
ON OPERATORS AND MOTIONS
Many commands that change text are made from an operator and a motion.The format for a delete command with the d delete operator is as follows:
d motion
Where:
d: is the delete operator.
motion: is what the operator will operate on (listed below).
A short list of motions:
w - until the start of the next word, EXCLUDING its first character.
e - to the end of the current word, INCLUDING the last character.
$ - to the end of the line, INCLUDING the last character.
Thus typing de will delete from the cursor to the end of the word.
Pressing just the motion while in Normal mode without an operator will move the cursor as specified.
USING A COUNT FOR A MOTION
Typing a number before a motion repeats it that many times.
Type 2w to move the cursor two words forward.
Type 3e to move the cursor to the end of the third word forward.
Type 0 (zero) to move to the start of the line.
USING A COUNT TO DELETE MORE
Typing a number with an operator repeats it that many times.
In the combination of the delete operator and a motion mentioned above you insert a count before the motion to delete more:
1 |
|
Type d2w to delete the two UPPER CASE words.
Type 2dd to delete two lines.
Type p
to put previously deleted text after the cursor
Type dd to delete the line and store it in a Vim register.Then, move the cursor to the line, ABOVE where the deleted line should go.Type p
to put the line below the cursor.
Type rx
to replace the character at the cursor with x
Move the cursor so that it is on top of the first error. Typer
and then the character which should be there.