Chapter 3. Vim Editor

Normal Mode (2) – Delete

Normal Mode (2) – Delete
Tag:

There are several ways to delete characters in Normal mode.

x or backspace (delete + fn on Mac) : delete the character under the cursor

dd : delete the line under the cursor

ndd : delete multiple lines (current line and lines below). n is the number of lines that you want to delete. For example, if you want to delete the current line and the line below, type 2dd.

d^ : delete characters from the beginning of the line to the current character

d$ : delete characters from the current character to the end of the line

dG : delete lines from the current line to the last line

IdeaTips: Deleting actions in Insert mode

  • In Insert mode, you cannot use these delete keyboard actions except backspace (delete + fn on Mac).
  • In Normal mode, you cannot use the delete key; however, you can use it in the Insert mode

There are several ways to delete characters in Normal mode.

x or backspace (delete + fn on Mac) : delete the character under the cursor

dd : delete the line under the cursor

ndd : delete multiple lines (current line and lines below). n is the number of lines that you want to delete. For example, if you want to delete the current line and the line below, type 2dd.

d^ : delete characters from the beginning of the line to the current character

d$ : delete characters from the current character to the end of the line

dG : delete lines from the current line to the last line

IdeaTips: Deleting actions in Insert mode

  • In Insert mode, you cannot use these delete keyboard actions except backspace (delete + fn on Mac).
  • In Normal mode, you cannot use the delete key; however, you can use it in the Insert mode
Tag: