FG
💻 Software

How to invert the selection in vim?

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

Problem

After selecting a range of lines with the command, I would like to delete every line of the file that is NOT selected, so is a way to invert the selection -- select every line that is not selected? Like how deletes every line which does NOT contain FOO. If I had a range in mind and wanted to use it…

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: How to invert the selection in vim?

Low Risk

select your text which means ...

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment