Home remove-whitespace
Post
Cancel

remove-whitespace

In a search, \s finds whitespace (a space or a tab), and \+ finds one or more occurrences.

This removes whitespace from the end of the line

:%s/\s\+$//

This removes from the start of the line

:%s/^\s\+//

This post is licensed under CC BY 4.0 by the author.