Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to efficiently delete word, colon and a comma in VIM

Tags:

vim

vi

editor

ide

I often have the piece of code like this:

it "should do something", :focus do
  ...
end

When I want to delete , :focus I usually do

  1. Go to line 1: 1G
  2. Go to the colon: f:
  3. Delete colon (using around word, so I can repeat it): daw
  4. Delete focus (just repeat previous): ..
  5. Delete comma (move left and replace it with space): hr<SPACE>.

Is there any way steps 3-5 can be achieved more efficiently?

like image 595
Dmytrii Nagirniak Avatar asked Jan 05 '12 08:01

Dmytrii Nagirniak


2 Answers

You can go:

  1. 1G to go to first line
  2. f, to go to the comma
  3. dE to delete till the next end of WORD (WORD in capital letters is any sequence of characters that is not space).
like image 153
Benoit Avatar answered Oct 23 '22 18:10

Benoit


With your cursor on the , you could do v, e,e,d.

or d,2,e

like image 23
rejj Avatar answered Oct 23 '22 19:10

rejj