2 ms·
Brilliant, exactly. Another important point here: A big benefit of doing changes like this is that vi has the special command "." which repeats the last chang
by unoti 16y ago
Brilliant, exactly.
Another important point here: A big benefit of doing changes like this is that vi has the special command "." which repeats the last change. With a single keystroke, it makes the same change you did last.
In practice this comes in handy quite often. Let's say that I have a program which generates a bunch of images. Let's say it's generating 4 images, and 2 of them are thumbnails and 2 are big versions.
img1.save('x-th.png',100)
img1.save('x.png')
img2.save('y-th.png',100)
img2.save('y.png')
I want to change the thumbnails to .gif. I can't just use search and replace, because I only want to change 2 instances. (Technically I could with a regex, but forget about that for a moment.) I go to the first one I watch to change, use 'cwgif' which changes the png to gif. Then I navigate to the next one, and just press period. The period key is one of the monster productivity boosts you can get from vi.