Deleting to the beginning of line when line starts with whitespace characters

If the cursor in the middle of an empty space between beginning of line and the first character of the line, then you can delete the whole spaces with diw, that means: delete inner word. In this case word is the spaces.


You can also use | to goto column 0 of a line, which can be using in combination with d as d| to delete to column 0 of a line.

Source: http://hea-www.harvard.edu/~fine/Tech/vi.html


as @GWW mention and:

  • use c0 to delete to real begginning of the line and go insert mode.
  • c^ - delete to first non-blank character and go insert mode.

You can use d0 to delete to the real beginning of the line.

Tags:

Vim