Vim Recall繁體中文

Delete back to the first nonblank

d^

Example

Normal 0 / 2
  one two three
Cursor on line 1, column 11

Delete the range between the cursor and the first nonblank on the same line.

Vim registers

" Unnamed register
Characterwise · Uses Yank register 0saved
- Small delete register
CharacterwiseEmpty
· space ⇥ tab ↵ line break
Before & after
Before
  one two three
Cursor on line 1, column 11

Vim registers

" Unnamed register
Characterwise · Uses Yank register 0saved
- Small delete register
CharacterwiseEmpty
· space ⇥ tab ↵ line break
After
  three
Cursor on line 1, column 3

Vim registers

" Unnamed register Changed
Characterwise · Uses Small delete registerone·two·
- Small delete register Changed
Characterwiseone·two·
· space ⇥ tab ↵ line break

Start in Normal mode, at line 1, column 11 (one-based). The backward ^ motion stops at the first nonblank. Start on the t of three. Press d^.

Details & Vim help

Example replayed in Vim

Delete the range between the cursor and the first nonblank on the same line.

On a line with nonblank text, the deletion includes the left endpoint and stops before the right endpoint. Starting after the first nonblank keeps the indentation. Starting inside the indentation deletes toward the first nonblank. At the first nonblank the deletion range is empty.