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
Vim undo branches
Dayne Dayne (57)
Apr 12, 2021
0

You probably already know how to use vim's basic undo and redo features. For a quick refresher, read this short tutorial on how to use vim redo and undo.

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:
Vim undo branches
Vim undo branches
You probably already know how to use vim's basic undo and redo features. For a quick refresher, read this short tutorial on how to use vim redo and undo.
Dayne's profile picture DayneView guide
In these interests: vim
3 Ways to Use Tabs in Vim
3 Ways to Use Tabs in Vim
Vim tabs can be a great way to visualize which files you currently have open. Many vim users get bogged down by them and either end up working too hard to use them or give up altogether.
Dayne's profile picture DayneView guide
In these interests: vim
Vim redo and undo
Vim redo and undo
Learn how to undo and redo changes using vim. If you are brand new to vim, learn more about the basics in this intro to vim guide.
Dayne's profile picture DayneView guide
In these interests: vim
People also read:
Vim Text Objects: Using Vim Text Objects
Once you learn to think in text objects, you'll never be the same
How to Delete Blank Lines in Vim
How to Change Your Leader Key in Vim
Vim: How to Copy to Your System Clipboard
Basic vim commands
Basic Vim Commands
Because you've accidentally opened Vim and don't know how to exit
How to Format JSON in Vim
Vim: Convert Tabs to Spaces
How to Change or Switch the Case of Characters in Vim
Ack Search, Open Files in Vim
Vim: How to Remove Trailing Whitespace on Save in Vim
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
©2022 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.