Vim doesn’t delete underlying lines in Visual Block Mode

vim

In vim, by pressing Ctrl+V you can enter Visual block mode.
When I select multiple lines by moving around with h,j,k and l, and press delete using d or D, the text gets deleted, but the underlying lines remain there.

Which means although the text is gone, the surrounding code is still spaced out a lot.

Is there any way to delete the lines + the text?

Best Answer

If you want to select lines use linewise Visual mode (V). If you want to select characters use character Visual mode (v). If you want to select a rectangular block use blockwise Visual mode (Ctrl-V).

Deleting a visual rectangular block does not delete the lines. This is the expected behavior. If you want to select lines visually and delete them, use linewise visual mode (V), select the lines with j and k (or down-arrow and up-arrow), then press d to delete them.