asemisldkfj
the law is no protection
just saved me about a million years of my life.
instead of adding line breaks to the end of hundreds (literally) of lines of code, I did :g/^I^I^I^I^I-/normal $a<br /> and it took all of one second.
thank you, vi!
asemisldkfj
the law is no protection
(I was adding line breaks to the end of a bunch of lines that were five tabs in and started with dashes, if that isn't obvious.)
asemisldkfj
the law is no protection
on this same note, I despise HTML.
asemisldkfj
the law is no protection
hahaha I'm glad you posted that in this thread.
DaGr8Gatzby
Drunk by Myself
oh man that's classic!
asemi > i know, it really was the perfect thread to post in :)
is :g the same as :%s?
asemisldkfj
the law is no protection
good question. what's the percent sign in :%s for?
it does s for all lines
asemisldkfj
the law is no protection
well g stands for global, so maybe it's the same?
No, the format is like this:
<range>s/search/replace/flags
The g flag means that it will replace all occurences of <search> on the same line, for example with the line:
aa
:s/a/A/
Will output Aa
and :s/a/A/g
will output AA
and :3,5s/a/A/
Will replace a with A only on lines 3 through 5
btw.
You put put a range before most commands, this is not unique to :subtitute, see :help range
carpetsmoker: of course, but the g command was new to me. guess i'm still used to ed