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
"ap
Paste the line belowctrl-a
Increment the digitw
Move forward one wordctrl-a
Increment the digit"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
.
精彩评论