How to Delete a Line in Vim
The dd command deletes (and cuts) an entire line in one stroke. Combine it with a count to remove several lines at once.
Steps
- Delete the current line. In Normal mode, press dd. The line is removed and copied to the register so you can paste it elsewhere.
- Delete several lines. Type a number before dd, for example 3dd deletes three lines starting at the cursor.
- Delete a single character. Press x to delete the character under the cursor.
- Put a deleted line back. Press p to paste the most recently deleted line below the cursor.
In the Vim Browser Editor
These all work in the Vim Browser Editor, and u undoes the last change if you delete something by mistake.