[lug] Vim maps / vimrc files for html editing
Zan Lynx
zlynx at acm.org
Mon Feb 19 09:47:26 MST 2007
On Sun, 2007-02-18 at 14:20 -0700, dio2002 at indra.com wrote:
[snip]
> Is there away for vim to do substitutions across multiple files that are
> in the same directory or lower as teh current file you're applying the
> substittion to? The idea is that once you finish the substitutions in teh
> current file, it loads the next file, etc and applies teh substitution.
> If you want, you can have it prompt you to confirm the replacement as well
> versus doing it all automatically.
I use perl -i for these things. I have a pretty complicated script that
rewrites the HTML and Javascript for Baen e-books I download.
A simple substitution is really easy. It'd be something like:
find -name '*.c' | xargs perl -p -i -e 's/blah/foo/g'
You can give the perl -i option an extension for backup copies if you
like. I usually have the files in version control and cvs diff shows me
the changes. Otherwise I can use a copy of the file in a tmp directory,
which is what I do with the e-books, or I can use -i.bak and do:
find -name '*.bak' | while read x; do diff ${x%.bak} $x; done
This is a sort of after-action confirmation. If I see something I don't
like in the diff, I revert everything and try again.
--
Zan Lynx <zlynx at acm.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20070219/2635477f/attachment.pgp>
More information about the LUG
mailing list