VIM: How to go to the next line that doesn't contain a pattern?

This is a discussion on VIM: How to go to the next line that doesn't contain a pattern? within the Editors forums in Theory and Concepts category; as stated: VIM: How to go to the next line that doesn't contain a pattern? E.g., in the list below foo dog foo cat bar food nuff said and more to come Starting from the top, I want to go to the first line that doesn't contain "foo"....

Go Back   Application Development Forum > Theory and Concepts > Editors

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-02-2008, 03:46 PM
Kenny McCormack
Guest
 
Default VIM: How to go to the next line that doesn't contain a pattern?


as stated: VIM: How to go to the next line that doesn't contain a pattern?

E.g., in the list below

foo dog
foo cat
bar food
nuff said
and more to come

Starting from the top, I want to go to the first line that doesn't
contain "foo".

Reply With Quote
  #2  
Old 08-02-2008, 04:14 PM
canoe
Guest
 
Default Re: VIM: How to go to the next line that doesn't contain a pattern?

Kenny McCormack wrote:
> as stated: VIM: How to go to the next line that doesn't contain a pattern?
>
> E.g., in the list below
>
> foo dog
> foo cat
> bar food
> nuff said
> and more to come
>
> Starting from the top, I want to go to the first line that doesn't
> contain "foo".
>


^\%(\%(foo\)\@!.\)*$

Canoe
Reply With Quote
  #3  
Old 08-02-2008, 04:41 PM
Kenny McCormack
Guest
 
Default Re: VIM: How to go to the next line that doesn't contain a pattern?

In article <Ke3lk.41$ZV1.24@trnddc07>, canoe <canoe@nospam.com> wrote:
>Kenny McCormack wrote:
>> as stated: VIM: How to go to the next line that doesn't contain a pattern?
>>
>> E.g., in the list below
>>
>> foo dog
>> foo cat
>> bar food
>> nuff said
>> and more to come
>>
>> Starting from the top, I want to go to the first line that doesn't
>> contain "foo".
>>

>
>^\%(\%(foo\)\@!.\)*$
>
>Canoe


1) Surely there is an easier way - more direct. I'm pretty sure I used
to know how to do this: something like !/foo/
2) I don't want to have to re-engineer (reverse) the reg exp.
Obviously, foo isn't the actual case.

Reply With Quote
  #4  
Old 08-02-2008, 05:05 PM
canoe
Guest
 
Default Re: VIM: How to go to the next line that doesn't contain a pattern?

Kenny McCormack wrote:
> In article <Ke3lk.41$ZV1.24@trnddc07>, canoe <canoe@nospam.com> wrote:
>> Kenny McCormack wrote:
>>> as stated: VIM: How to go to the next line that doesn't contain a pattern?
>>>
>>> E.g., in the list below
>>>
>>> foo dog
>>> foo cat
>>> bar food
>>> nuff said
>>> and more to come
>>>
>>> Starting from the top, I want to go to the first line that doesn't
>>> contain "foo".
>>>

>> ^\%(\%(foo\)\@!.\)*$
>>
>> Canoe

>
> 1) Surely there is an easier way - more direct. I'm pretty sure I used
> to know how to do this: something like !/foo/
> 2) I don't want to have to re-engineer (reverse) the reg exp.
> Obviously, foo isn't the actual case.
>


There's LogiPat, a logical pattern handling plugin:

http://vim.sourceforge.net/scripts/s...script_id=1290

:LP !"foo"

Canoe
Reply With Quote
  #5  
Old 08-02-2008, 06:15 PM
Kenny McCormack
Guest
 
Default Re: VIM: How to go to the next line that doesn't contain a pattern?

In article <9_3lk.60$T91.38@trnddc04>, canoe <canoe@nospam.com> wrote:
....
>There's LogiPat, a logical pattern handling plugin:
>
> http://vim.sourceforge.net/scripts/s...script_id=1290
>
>:LP !"foo"
>
>Canoe


That looks interesting. It suggests that the problem isn't as easy as I
seem to remember it being (since a plugin was developed to address it).

Reply With Quote
  #6  
Old 08-02-2008, 08:59 PM
John Beckett
Guest
 
Default Re: VIM: How to go to the next line that doesn't contain a pattern?

Kenny McCormack wrote:
>That looks interesting. It suggests that the problem isn't as easy as I
>seem to remember it being (since a plugin was developed to address it).


You are possibly remembering how to list lines not containing foo:
:v/foo/p

Which can be entered simply as:
:v/foo

Canoe's advice looks best to me, and should be used to update some
tips on the wiki:
http://vim.wikia.com/wiki/Match_every_word_except_foo

John

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:48 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.