HomeInterestsSign UpSign In
HomeInterests
Share
FacebookRedditTwitterPinterestEmailText message
 
Discuss
Favorite
HomeInterestsVim

Delete all Trailing Whitespace in Vim

John John (304)
Nov 19, 2020
2 minutes
Share
FacebookRedditTwitterPinterestEmailText message
Discuss
 
Favorite

This short guide will tell you how to delete all trailing whitespace in Vim. You can also delete trailing whitespace on save in Vim!

Vim: How to Remove Trailing Whitespace on Save in Vim Vim: How to Remove Trailing Whitespace on Save in Vim
Interests
Posted in these interests:
Vim
h/vim • 23 guides
Share
FacebookRedditTwitterPinterestEmailText message
 
Discuss
Favorite
In these interests
Vim
h/vim • 23 guides
1

From normal mode, enter command mode and type:

:%s/\s\+$//
Share
FacebookRedditTwitterPinterestEmailText message
Discuss
Favorite
NEXT UP
How to Format JSON in Vim
John John (304)
Aug 11, 2021
5 minutes

Vim is amazing. Well, Python is doing all the work, but I still like Vim. Learn how to format JSON in Vim like a pro with this short guide! tl;dr Paste your json, and run this in vim normal mode. :%!

Continue reading
Share
FacebookRedditTwitterPinterestEmailText message
Discuss
Favorite
Share this guide!
  • Facebook
  • Twitter
  • Reddit
  • Email
  • Text
John's profile pictureJohn
Joined in 2015 304 guides
Software Engineer and creator of howchoo.
Related to this guide:
How to Format JSON in Vim
How to Format JSON in Vim
Vim is amazing. Well, Python is doing all the work, but I still like Vim. Learn how to format JSON in Vim like a pro with this short guide! tl;dr Paste your json, and run this in vim normal mode. :%!
John's profile picture JohnView guide
In these interests: vimpython
How to Use Custom Key Mappings in Vim
How to Use Custom Key Mappings in Vim
I find Vim to be very useful in my daily development activities. I was delighted to learn that you can have your own key mappings in Vim. It is documented very well in the vim help section.
Ashley's profile picture AshleyView guide
In these interests: vimcode
Highlight search terms in vim
Highlight search terms in vim
By default, vim does not highlight search terms, and it can be difficult to find them in the document. If you're new to Vim, check out our guide on how to get started with Vim.
John's profile picture JohnView guide
In these interests: vim
People also read:
Basic vim commands
Basic Vim Commands
Because you've accidentally opened Vim and don't know how to exit
How to Delete Blank Lines in Vim
How to get started using vim
How to install Vim plugins without a plugin manager
Vim undo branches
Vim Cheat Sheet for Beginners
Vim Text Objects: Using Vim Text Objects
Once you learn to think in text objects, you'll never be the same
How to Change or Switch the Case of Characters in Vim
Edit and execute a command on the unix command line from vim
Vim redo and undo
Posted in these interests:
vim
Explore
Vim
h/vim • 23 guides
Discuss this guide!
Discover interesting things!
Explore Howchoo's most popular interests.

Explore
ExploreShopJobsWrite for us!Our teamContact us

Follow @howchoo and learn cool things:

FacebookYouTubeInstagramTwitter

Are you a passionate writer? We're hiring!

Write for Howchoo

Like what we do?

Donate
©2023 Howchoo, LLC
SitemapTerms of usePrivacy policyDMCA requestsDo not sell my personal information

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.