Remove unwanted whitespace in vim

You can remove the annoying whitespaces at the beginning or end of line in vim using the below steps.

STEPS

1. Remove trailing whitespace at the end of each line:
 Press ESC key and type the following, then press Enter key
:%s/\s\+$//e

2. Remove trailing whitespace at the start of each line:
 Press ESC key and type the following, then press Enter key
:%s/^\s\+//e

Kindly comment below if it works for you.

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

©2023 ZMATECH: Innovative solutions for your IT challenges.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

Log in with your credentials

Forgot your details?