I believe that
emacs is ultimately more powerful than
vi because it is written in
Lisp and allows you to modify how it works on the fly. However, vi is smaller and faster -- sort of for the same reason -- and I prefer to use it for quick edits. In emacs I often
M-% to query replace. So it's about time I
found out how to do the same thing in vi:
: %s/foo/bar/gc
It's a lot like
sed except for the
c option which sed doesn't have since it's non-interactive by
definition:
$ echo "I like unix" | sed s/i/u/
I luke unix
$ echo "I like unix" | sed s/i/u/g
I luke unux
$ echo "I like unix" | sed s/i/u/gi
u luke unux
$ echo "I like unix" | sed s/i/u/gc
sed: -e expression #1, char 8: unknown option to `s'
$
Think of the
c as
confirm.
No comments:
Post a Comment