vim deleting backward tricks

Solution 1:

In general, d<motion> will delete from current position to ending position after <motion>. This means that:

  1. d<leftArrow> will delete current and left character
  2. d$ will delete from current position to end of line
  3. d^ will delete from current backward to first non-white-space character
  4. d0 will delete from current backward to beginning of line
  5. dw deletes current to end of current word (including trailing space)
  6. db deletes current to beginning of current word

Read this to learn all the things you can combine with the 'd' command.

Solution 2:

I have been in this scenario many times. I want to get rid of all the spaces in line 10 so it would join with line 9 after the comma.

enter image description here

This is basically a simple line join in VIM.

kJ does the trick (watch below)

Vim Join Lines

Solution 3:

To answer point #3, diw and daw are excellent.