Path: utzoo!mnetor!uunet!husc6!bloom-beacon!mit-eddie!uw-beaver!tektronix!tekig5!tekig4!brianr From: brianr@tekig4.TEK.COM (Brian Rhodefer) Newsgroups: comp.editors Subject: Re: Query-replace on VI Message-ID: <2793@tekig4.TEK.COM> Date: 5 May 88 20:32:21 GMT References: <2587@geac.UUCP> <27909@yale-celray.yale.UUCP> <86@skep2.ATT.COM> <393@aiva.ed.ac.uk> Reply-To: brianr@tekig4.UUCP (Brian Rhodefer) Organization: Tektronix, Inc., Beaverton, OR. Lines: 17 Summary: Can too! It may not be very glamorous, but when I want a "query-replace"ish operation in vi, I find the first occurrence of the string with the slash "/" character, and, if it's an occurrence I want to replace, I replace it with a suitable "change" operation, e.g., "cwBAR". Having done this, the "n" key finds subsequent occurrences, and the "." key repeats the substitution, if desired. If you elect NOT to do the replacement on a particular occurrence, just hit "n" again. If you count keystrokes, this method is just as efficient as a real query-replace command would be. Coping with vi's egregious lack of a single-keystroke witticism injector (but just barely), Brian Rhodefer