[comp.editors] Doing an nfind in vi

carlson@mrx.webo.dg.com (James Carlson) (05/24/91)

This might be a FAQ, but here goes:

Does anyone out there know how to locate the next line that does *not*
contain a particular string in vi?  I can do an 'nfind' in vi (locate the
next line that does not start with a particular string), but I can't seem
to figure out how to do an 'nlocate'.

advTHANKSance.
-- 
Disclaimer:  I cannot speak for Data General.  You should have guessed that.
Mail to:  carlson@mrx.webo.dg.com  -or-  James_Carlson@dgc.mceo.dg.com
.//.

hansm@cs.kun.nl (Hans Mulder) (05/27/91)

In <1356@dg.dg.com> carlson@mrx.webo.dg.com (James Carlson) asks:
>Does anyone out there know how to locate the next line that does *not*
>contain a particular string in vi?

The best I can come up with is

:+,$v/string/a

This will move the cursor to the next line not containing the string and
then inform you that :a is not a legal command from open/visual mode.

Anyone with a better idea?


Hans Mulder	hansm@cs.kun.nl

a0cb@.cc.pdx.edu (Chris Bertholf) (06/05/91)

In article <3593@wn1.sci.kun.nl> hansm@cs.kun.nl (Hans Mulder) writes:
>In <1356@dg.dg.com> carlson@mrx.webo.dg.com (James Carlson) asks:
>The best I can come up with is
>
>:+,$v/string/a
>Anyone with a better idea?
>

Well

:+,$v/string/p

doesnt print the error message...

   __
  /  ) /         
 /    /_  __  o _ 
(__/ / /_/ (_<_/_)_
   __
  /  ) /         
 /    /_  __  o _ 
(__/ / /_/ (_<_/_)_

hansm@cs.kun.nl (Hans Mulder) (06/06/91)

In <2803@pdxgate.UUCP> a0cb@.cc.pdx.edu (Chris Bertholf) writes:
>In article <3593@wn1.sci.kun.nl> hansm@cs.kun.nl (Hans Mulder) writes:
>>In <1356@dg.dg.com> carlson@mrx.webo.dg.com (James Carlson) asks:
>>The best I can come up with is
>>
>>:+,$v/string/a
>>Anyone with a better idea?
>>
>:+,$v/string/p

>doesnt print the error message...

but it doesn't move the cursor to the correct line, either...

(Remember the exercise is to move the cursor to the next line not
 containing the string.)

--
Have a nice day,

Hans Mulder	hansm@cs.kun.nl

carlson@mrx.webo.dg.com (James Carlson) (06/06/91)

In article <2803@pdxgate.UUCP>, a0cb@.cc.pdx.edu (Chris Bertholf) writes:
|> In article <3593@wn1.sci.kun.nl> hansm@cs.kun.nl (Hans Mulder) writes:
|> >In <1356@dg.dg.com> carlson@mrx.webo.dg.com (James Carlson) asks:
|> >The best I can come up with is
|> >
|> >:+,$v/string/a
|> >Anyone with a better idea?
|> >
|> 
|> Well
|> 
|> :+,$v/string/p
|> 
|> doesnt print the error message...

Which, of course, is nice, but it also doesn't do the same thing, which isn't nice.

(I just tried it, and it scrolls the *entire* file except for the lines with the
/string/ in them by the screen and then says "[Hit return to continue]" -- I never
did like abusing keys -- and when I do *that* the cursor is placed at the last line
of the file.  That's not quite what I wanted, although it is amusing.)

-- 
Disclaimer:  I cannot speak for Data General.  You should have guessed that.
Mail to:  carlson@mrx.webo.dg.com  -or-  James_Carlson@dgc.mceo.dg.com
.//.