On Tuesday, July 17, 2012 7:27:42 PM UTC-5, Bee wrote:
> This will collapse multiple blank lines,
> remove trailing white space, and
> leave only one blank line at the end of file.
>
> %s-\_s\+$-\r
>
> Bill
I found the problem with this one. :help /$ indicates that the $ is zero-width, so the end of line is not included in the match, therefore on the two blank lines at the beginning of the file, only the first is included in the match.
So, this works exactly as I think it should:
%s-\_s\+\n-\r
Note this is almost identical to my first proposed solution, except that it is missing the beginning of line anchor. I'm not sure what makes it fail with the ^ in place.
--
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:
Post a Comment