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

  • Home
  • SEARCH
  • 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 8150735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:09:05+00:00 2026-06-06T15:09:05+00:00

I have ths line in my .vimrc: map gu :%s/\s\+$//<enter> :w<enter> to remove trailing

  • 0

I have ths line in my .vimrc:

map gu :%s/\s\+$//<enter> :w<enter>

to remove trailing spaces and saving the file in the same time.

When there are trailing spaces in the file, it works OK (it removes the spaces and saves the file), but when there are not trailing spaces it doesn’t save the file, it just says Pattern not found: \s+$.

NOTE: I found this, but I’m curious about the way I’m asking.

  • 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-06-06T15:09:07+00:00Added an answer on June 6, 2026 at 3:09 pm

    Add an e to the search flags to suppress error messages:

    map gu :%s/\s\+$//e<enter> :w<enter>
    

    From :help substitute:

    [e]     When the search pattern fails, do not issue an error message and, in 
            particular, continue in maps as if no error occurred.  This is most 
            useful to prevent the "No match" error from breaking a mapping.  Vim 
            does not suppress the following error messages, however:  
                Regular expressions can't be delimited by letters
                \ should be followed by /, ? or &
                No previous substitute regular expression
                Trailing characters
                Interrupted
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

suppose I have a model and a view ,ths view have two method:one is
have written this little class, which generates a UUID every time an object of
Have deployed numerous report parts which reference the same view however one of them
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I have been looking through ths hashlib documentation but haven't found anything talking about
Hey there. been a busy debugger today. ill give ths short version. ive made
I'm using Rails 3, ActiveAdmin and Kaminari. I have this on the documents.rb file
I have ths function to query a set of records from the DB: public
Ive got ths really annoying issue I have grouped a set of data and
I am a Perl newbie, and i'm stuck with ths problem: I have a

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.