In vim, is there a way to advance from the current line or cursor position to the next line that doesn't contain one of several regular expressions? For example, I can use /RegExp/<CR>
or :g/RegExp/<CR>
, but I want to go to the next line that doesn't match RegExp
, which could be quite a bit further down. RegExp
might be ^ inflating: \|^ extracting:
. Command g!/RegExp/<CR>
does not do the trick.
Add a comment
|
1 Answer
I found that /^\( inflating: \| extracting: \)\@!<CR>
works.
For years if not decades, I found that zero-width matches evaded intuitive comprehension, especially those of the backward and non-matching type. For this reason, I've posted this answer rather than erasing the question. If this is too elementary, just let me know in the comments and I will erase the question. Thanks.
-
1No, this is great to have. I think there might be a dupe, but I can't really be bothered to go find it… so have some rep :)– D. Ben Knoble ♦Commented Oct 4, 2021 at 21:55