FG

How to do an inverse search in Vim? (i.e., get lines not containing pattern)

Fresh3 days ago
Mar 15, 202619700 views
Confidence Score0%
0%

Problem

With I can do a to get all the lines without "my search". With I can to find replace text on lines with out "baz". Is there a way to do the same thing in Vim? And is it possible to do it without "s///" syntax, and only using the "/" search syntax?

Error Output

grep

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to do an inverse search in Vim? (i.e., get lines not containing pattern)

Low Risk

matches all the lines were pattern is found. does the opposite. See for more details. You can use it like this: to prepend "pattern not found - " to every line that doesn't have "pattern" or to replace "nrettap" with "pattern" on every line that doe…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment