Remove trailing whitespace with VIM

Here’s a quick tip on how to get rid of unwanted trailing whitespace using vim. Let’s say, I have the following code: Open that file with vim. The following command deletes any trailing white spaces. :%s/\s\+$//e Here’s the screenshot of the text after removing the whitespace: In search, \s finds whitespace (a space or tab). \+ finds one or more occurrences. $ matches the end of line, finally e flag means no error is displayed....

July 27, 2017 · 1 min · 96 words · kenno