Wednesday, July 2, 2014

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

Hi,

you could use a macro the create the multiple lines at first place, start with

    let(:user1) { FactoryGirl.create(:user, gender: 'f') }

press "qa" to record macro "a"
yypCtrl+aq; yank line, paste line, increment first number, stop recording.
Now you just call the macro 5 times: 5@a

Hope you get what you are looking for.

regards,
Stefan




2014-07-02 14:31 GMT+02:00 Arup Rakshit <aruprakshit@rocketmail.com>:
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

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment