6.5.5 Deleting Text
These vi commands delete the character, word, or
line you indicate. vi stays in command mode, so any subsequent
text insertions must be preceded by additional commands to enter entry mode.
18.104.22.168 Deleting One Character
To delete one character, position the cursor over the character to be
deleted and type x.
The x command also deletes the space the character
occupied--when a letter is removed from the middle of a word, the remaining
letters will close up, leaving no gap. You can also delete blank spaces in
a line with the x command.
To delete one character before (to the left of) the cursor, type X (uppercase).
22.214.171.124 Deleting a Word or Part of a Word
To delete a word, position the cursor at the beginning of the word and
type dw. The word and the space it occupied are removed.
To delete part of a word, position the cursor on the word to the right of the part to be saved. Type dw to delete
the rest of the word.
126.96.36.199 Deleting a Line
To delete a line, position the cursor anywhere on the line and type dd. The line and the space it occupied are removed.
188.8.131.52 Deleting Part of a Line
You can also delete part of a line.
To delete everything to the right of the cursor,
position the cursor to the right of the part of the line you want to save,
and type D.
To delete everything to the left of the cursor,
position the cursor to the right of the part of the line you want to delete
and type d0 (d-zero).
184.108.40.206 Deleting to the End of the File
To delete everything from the current line to the end of the file, type dG. This also deletes the line on which the cursor is located.
220.127.116.11 Deleting from Beginning of File
To delete everything from the beginning of the file to the current line,
type d1G. This also deletes the line on which the cursor