Wednesday, July 2, 2014

Vim trick to make all the same numbers to replace by the numbera in ascending order ?

Hi Suppose,

I have below data :

  describe ".employee_learning" do
    let(:user1) { FactoryGirl.create(:user, gender: 'f') }
    let(:user1) { FactoryGirl.create(:user, gender: 'f') }
    let(:user1) { FactoryGirl.create(:user, gender: 'f') }
    let(:user1) { FactoryGirl.create(:user, gender: 'f') }
    let(:user1) { FactoryGirl.create(:user, gender: 'f') }
    let(:user1) { FactoryGirl.create(:user, gender: 'f') }
    let(:user1) { FactoryGirl.create(:user, gender: 'f') }
    let(:user1) { FactoryGirl.create(:user, gender: 'f') }
  end

Only first line I wrote.. then I did Shift + v, then yanked and then 7p. These many action created the above all similar lines. Now I am looking for a trick, so that I can make all user1(s), in one shot like user1-user7. Hope I am able tell you people about my expectation :-) Is this really possible ? or manually *r* command is the only trick to replace each 1 to 2,3,4 increasing order ?
 
Regards,
Arup Rakshit

No comments:

Post a Comment