Deleting
Occasionally, you will reread your document an hour after creating it and decide that you need to delete a character, a word, an entire line, or an entire group of lines. The following lists the commands to handle deletions. Be aware that the dd and dw commands are two of the rare commands that actually require two keystrokes to execute.
The following are the deletion commands:
x— Delete the character where the cursor is
dw— Delete the word where the cursor is
dd— Delete the line where the cursor is
Suppose you make a deletion and realize that it wasn't what you really wanted to do. The vi editor allows you to undo the last command you executed by using the u command. The u command actually takes the contents of the delete buffer (called ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access