开发者

what is the best way to edit similar strings?

I need to make 开发者_JAVA技巧next task:

file:

string1 data1 data

I need to create more strings with only changes in digits

string2 data2 data
string3 data3 data
string4 data4 data

How can i do it fast ?


select that input line, yank it into buffer a: "ayy.

Then record the following sequence: qq

  1. "ap Paste the line below
  2. ctrl-a Increment the digit
  3. w Move forward one word
  4. ctrl-a Increment the digit
  5. "ayy Yank this line in as your new baseline

End your macro with q

Then repeat it as many times as you need (let's say 42), with 42@q


Several plugins manage that: visincr.vim, increment.vim.

I use visincr and that is very easy: Visual block, :I.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜