2

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.

2

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.

1
  • 1
    No, 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
    Oct 4 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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