match all lines that don't match pattern

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

match all lines that don't match pattern

Jason Deyoe
Hi all,

I'm trying to perform a pattern match on all lines in a vim file that
do not contain a certain value.

so with file contents:


foo
fool
foot
foobar
bar
stooge

search would return all lines that do not contain "foo":
something like

!/foo.\+\n


anyone know how to do this?

Thanks in advance,

Jason


Reply | Threaded
Open this post in threaded view
|

Re: match all lines that don't match pattern

Charles E Campbell Jr
Quoting Jason Deyoe <[hidden email]>:

> I'm trying to perform a pattern match on all lines in a vim file that
> do not contain a certain value...
> search would return all lines that do not contain "foo":

Check out LogiPat.vim:

http://vim.sourceforge.net/scripts/script.php?script_id=1290

Regards,
Chip Campbell

Reply | Threaded
Open this post in threaded view
|

RE: match all lines that don't match pattern

Clint Harames
In reply to this post by Jason Deyoe
If you want to do a global command on the lines, such as delete all
lines not containing foo, then do this ...

g!/foo/d

But if all you want to do is highlight the entire line of any line  not
containing foo, I would suggest a recent script by Dr. Chip called
LogiPat.
After installing it you simply type

:LogiPat !"foo"

The script is here:
http://vim.sourceforge.net/scripts/script.php?script_id=1290
-Clint


-----Original Message-----
From: Jason Deyoe [mailto:[hidden email]]
Sent: Monday, June 06, 2005 10:18 AM
To: [hidden email]
Subject: match all lines that don't match pattern

Hi all,

I'm trying to perform a pattern match on all lines in a vim file that
do not contain a certain value.

so with file contents:


foo
fool
foot
foobar
bar
stooge

search would return all lines that do not contain "foo":
something like

!/foo.\+\n


anyone know how to do this?

Thanks in advance,

Jason


Reply | Threaded
Open this post in threaded view
|

RE: match all lines that don't match pattern

Brent Saunders
In reply to this post by Jason Deyoe
v/foo/d has one less keystroke.

-----Original Message-----
From: Clint Harames [mailto:[hidden email]]
Sent: Monday, June 06, 2005 10:54 AM
To: Jason Deyoe; [hidden email]
Subject: RE: match all lines that don't match pattern

If you want to do a global command on the lines, such as delete all
lines not containing foo, then do this ...

g!/foo/d

But if all you want to do is highlight the entire line of any line  not
containing foo, I would suggest a recent script by Dr. Chip called
LogiPat.
After installing it you simply type

:LogiPat !"foo"

The script is here:
http://vim.sourceforge.net/scripts/script.php?script_id=1290
-Clint


-----Original Message-----
From: Jason Deyoe [mailto:[hidden email]]
Sent: Monday, June 06, 2005 10:18 AM
To: [hidden email]
Subject: match all lines that don't match pattern

Hi all,

I'm trying to perform a pattern match on all lines in a vim file that
do not contain a certain value.

so with file contents:


foo
fool
foot
foobar
bar
stooge

search would return all lines that do not contain "foo":
something like

!/foo.\+\n


anyone know how to do this?

Thanks in advance,

Jason