FG
💻 Software

Prepend only lines with text in vim

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

Problem

I've got a list like below: How can I insert things at the beginning of only those lines with text? will put just fine, but since it does all lines, it gets the empty lines, too. Is there any way to do this without having to go back and clear out those blank spaces (I know they'd be just *, so it s…

Error Output

words
more words
here's more

skip space
words here
bananza!


D: look
more spaces
and words!

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Prepend only lines with text in vim

Low Risk

Something like this should work: EDIT Since you asked for a breakdown of the regular expression: All lines Beginning of substitute command; begin pattern Beginning of line Beginning of group we want to preserve. This will be important later. Any num…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment