Deleting Text
After opening a VI session, often you'll want to delete "things" from your file:
- CTRL+h or Backspace - Delete previous character
- CTRL+w - Delete previous word
- CTRL+x - Delete to start of inserted text
- nx - Delete n characters beginning with current; omitting n deletes current character
- nX - Delete previous n characters; omitting n deletes previous characters
- ndw - Delete next n words beginning with current; omitting n deletes current word
- ndb - Delete previous n words; omitting n deletes previous word
- ndd - Delete n lines beginning with current; omitting n deletes current line
- :n, md - Delete lines n through m
- D or d$ - Delete from cursor to end of current line
- dcursor_cmd - Delete text to cursor_cmd (e.g. dG deletes from current line to end of file)
Placed here for easy reference.
Loading comments...