Monday, February 7, 2011

Re: Remove trailing spaces

On Mon, Feb 7, 2011 at 4:20 PM, Joan Miquel Torres Rigo <joanmiquel@mallorcaweb.net> wrote:
2011/2/8 Michael(Xi Zhang) <michaelxmail@gmail.com>:
> Hi  ,
>
> I wrote a function , it will read lines from a file, each line is a
> directory, after got the line, I will add filetype filter at the end of it.
> If user put some spaces at end of the line, it will cause error.
>
> Is there any way to remove the trailing spaces?

Something like this?

:%s/\s\+$//

Cheers

Thanks!

If I open the file with VIM, then I can type this command. It can work.

Now every time I press a mapped key in VIM, my function will read lines from a file(each line is a directory), if there are spaces at end of line, it will cause problem in the next step.

What I want is remove these spaces in this function, even user put spaces at end of line.
 

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: