Thursday, July 5, 2012

Re: How to remove empty lines except of one

On Thu, Jul 5, 2012 at 4:24 PM, Tim Chase wrote:
As for blank-ish lines (containing just whitespace), it might become
something like

 %s/^\(\s*\n\)\+/\r


I added this to my .vimrc as:

command RemoveMultipleBlankLines %s/^\(\s*\n\)\+/\r

Now ":RemoveMultipleBlankLines" works like it should except when my file has a blank line at the very end.
In this case, I get 2 blank lines at the end.
Any idea how I can prevent that?

- Gautam

--
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: