FG
💻 Software

Is there an opposite of :g in vim?

Fresh5 days ago
Mar 15, 20263241 views
Confidence Score0%
0%

Problem

I know how to do something to every line that matches a pattern, using . Is there a way to do something to every line that does not match the pattern? For example, suppose I want to delete every line that does not match /foo/. I might do something like: ( is not the opposite of , but that is what I…

Error Output

:G/foo/d

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Is there an opposite of :g in vim?

Low Risk

I think there is a inversion within VIM as, or, like the command (below), If you are ready to go to the shell prompt, will do this

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment