Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 871479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:38:47+00:00 2026-05-15T10:38:47+00:00

I happened across this page full of super useful and rather cryptic vim tips

  • 0

I happened across this page full of super useful and rather cryptic vim tips at http://rayninfo.co.uk/vimtips.html. I’ve tried a few of these and I understand what is happening enough to be able to parse it correctly in my head so that I can possibly recreate it later. One I’m having a hard time getting my head wrapped around though are the following two commands to remove all spaces from the end of every line

:%s=  *$==                  : delete end of line blanks
:%s= \+$==                  : Same thing

I’m interpreting %s as string replacement on every line in the file, but after that I am getting lost in what looks like some gnarly variation of :s and regex. I’m used to seeing and using :s/regex/replacement. But the above is super confusing.

What do those above commands mean in english, step by step?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T10:38:47+00:00Added an answer on May 15, 2026 at 10:38 am

    The regex delimiters don’t have to be slashes, they can be other characters as well. This is handy if your search or replacement strings contain slashes. In this case I don’t know why they use equal signs instead of slashes, but you can pretend that the equals are slashes:

    :%s/  *$//     
    :%s/ \+$//     
    

    Does that make sense? The first one searches for a space followed by zero or more spaces, and the second one searches for one or more spaces. Each one is anchored at the end of the line with $. And then the replacement string is empty, so the spaces are deleted.

    I understand your confusion, actually. If you look at :help :s you have to scroll down a few pages before you find this note:

    *E146*

    Instead of the '/' which surrounds the pattern and replacement string, you
    can use any other character, but not an alphanumeric character, '\', '"' or
    '|'. This is useful if you want to include a '/' in the search pattern or
    replacement string. Example:

    :s+/+//+
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I happened across this article about hardware based hard drive encryption and realized that
While working on a upgrade i happened to come across a code like this.
This has happened to me 3 times now, and I am wondering if anyone
I was looking at some lazy loading property decorators in Python and happened across
I happened across the source for Minix's gmtime function. I was interested in the
I came across this problem two or three times. One of my customer restored
Has anybody come across this? I've taken the GTK HelloWorld sample . It runs
This has happened many times before, but I never bothered to figure out why,
Is this normal behavior; this never happened to me before. I assume it would
This happened without me changing anything except upgrading to 3.2.1 2 weeks ago. in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.