[ILUG] vi tip...
kevin lyda
kevin+dated+1082456802.8afea6 at ie.suberic.net
Thu Apr 15 11:26:33 IST 2004
for vi users who don't know about recording...
ok, for years i'd accidentally type q and then there'd be this annoying
"recording" thing in the bottom left. so i finally went and figured out
how to use it. let's say you have this file:
http://moo/images/img_0123.jpg
http://moo/images/img_0145.jpg
http://moo/images/img_0167.jpg
http://moo/images/img_0170.jpg
http://moo/images/img_0212.jpg
and you want to change jpg to jpeg, remove the leading 0, and increment
each number by 10. i know, a contrived example, but for demo purposes...
the way recording works is you press q<letter><a series of commands>q
to record. and @<letter> to play the recorded commands back.
so to do this task we'll do this:
start recording in recording buffer a qa
search for jpg /jpg<return>
change it to jpeg cwjpeg<esc>
go to the 0 F_l
delete it x
increment it by 10 10<C-a>
end recording q
then rerun the recording with @a for each remaining line:
http://moo/images/img_133.jpeg
http://moo/images/img_155.jpeg
http://moo/images/img_177.jpeg
http://moo/images/img_180.jpeg
http://moo/images/img_222.jpeg
kevin
--
kevin at ie.suberic.net ~ Would you put on your resume that 3,000 people
died due to your failure while you were in charge?
So why is George Bush?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.linux.ie/pipermail/ilug/attachments/20040415/10aaf5c3/attachment.pgp
More information about the ILUG
mailing list