[Cialug] vim global replace
Colin Burnett
cmlburnett at gmail.com
Fri Sep 18 12:36:03 CDT 2009
On Fri, Sep 18, 2009 at 10:02 AM, Todd Walton <tdwalton at gmail.com> wrote:
>
> :s/^/'/g
Aside from the already answered use of % you can also do
<movement to first line>V<movement to last line>:s/^/'/g
V is visual line mode where you can highlight the lines you want to
apply the replace to. Much easier if you want to do it on a few lines
without having to care about exact line numbers.
So :%s/foo/bar/g would be equivalent to GVgg:s/foo/bar/g in that way.
Colin
More information about the Cialug
mailing list