Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!axion!stc!praxis!hilbert!aap From: aap@praxis.co.uk (Andy Pryor) Newsgroups: comp.editors Subject: Re: vi macros Message-ID: <3989@newton.praxis.co.uk> Date: 28 Apr 89 10:16:44 GMT References: <575@hrc63.co.uk> Sender: news@praxis.co.uk Reply-To: aap@praxis.co.uk (Andy Pryor) Organization: Praxis Systems plc, Bath, UK Lines: 24 In article <575@hrc63.co.uk> cd@hrc63.co.uk (Colin Denman "GECCL") writes: > >Dear Auntie, >I would like a vi macro that behaves like control-], but takes the word >under the cursor as a search pattern. I can see how to yank the word, but >not how to search for the contents of a buffer. Any advice ? I use SunOS3.5. I have the following in my vi start-up file that binds the function you want to the FIND key on my vt220. You should be able to adapt it to what you want. (I have changed the control characters into printables.) " FIND = find next occurrence of current word :map ^[[1~ yeo^V^[pI/^V^["kdd@k This only looks in the current buffer of course. If you want to search a set of files in a similar fashion to ^], it will involve generating a macro that invokes an external command like grep. Needless to say, I haven't tried this! Hope this helps. Andy Pryor Praxis Systems plc, 20 Manvers St, BATH BA1 1PX, UK Tel: +44 225 444700 ...!uunet!mcvax!ukc!praxis!aap