Today I Learned

hashrocket A Hashrocket project

Find & replace newlines or whitespace with Vim

If you're looking to collapse lines via a find/replace in Vim, you probably need to kill both whitespace and newlines. Use \_s to match against both. Here's the situation where I just now made use of this:

          %label Name

To remove the %label here, select the range in visual mode, type s/\_s*%label//g, and you'll get:

        %dt Name
See More #vim TILs
Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.