4

The / command moves to the next occurrence of a pattern. But how do I move to the next line in which a pattern does not appear?

2
  • You might have a look here.
    – cbaumhardt
    Commented Aug 27, 2015 at 17:57
  • 1
    ... which gives something like /\v^((pattern)@!.)*$
    – VanLaser
    Commented Aug 27, 2015 at 18:03

1 Answer 1

6

Recent Vims come with the LogiPat plugin. With that, you can simply do

:LogiPat !"foo"

and it will jump to the next line, not containting your pattern. To see the pattern, you can type

:echo @/

which should show something like ^\%(\%(foo\)\@!.\)*$

3
  • 1
    TIL :LogiPat :)
    – VanLaser
    Commented Aug 27, 2015 at 19:03
  • Beware however that the patterns produced by LogiPat are not always perfect (cf. :help logipat-caveat). "Negating" regexps is always tricky, and LogiPat is not a silver bullet. Commented Aug 27, 2015 at 19:05
  • @SatoKatsura True Commented Aug 27, 2015 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.