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?
1 Answer
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\)\@!.\)*$
-
1
-
Beware however that the patterns produced by
LogiPat
are not always perfect (cf.:help logipat-caveat
). "Negating" regexps is always tricky, andLogiPat
is not a silver bullet. Aug 27, 2015 at 19:05 -
/\v^((pattern)@!.)*$