🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #3117

Re: Query-replace on VI

#3117
From: Brian Rhodefer
Date: Thu, 05 May 1988 20:32
17 lines
1193 bytes
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<esc>".
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
Technical Details
Message-ID: <2793@tekig4.TEK.COM>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!bloom-beacon!mit-eddie!uw-beaver!tektronix!tekig5!tekig4!brianr
References: <2587@geac.UUCP> <27909@yale-celray.yale.UUCP> <86@skep2.ATT.COM> <393@aiva.ed.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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!