How to remove 2 or more empty lines when closing the the file?
Hi, With the follwing subtitue it's possible to remove blocks of 3 empty lines :%s/^\n\{3}// How do you need to change it, so that it does remove blocks of 2, or more, empty lines? And how do you give this command just before closing the file? Rgds, Eric _ Get a FREE Web site, company branded e-mail and more from Microsoft Office Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/
Re: How to remove 2 or more empty lines when closing the the file?
On 3/30/07, Jean-Rene David [EMAIL PROTECTED] wrote: Note that this implementation will give you a warning if the pattern is not found. I'm using this to remove trailing spaces: Remove trailing spaces when saving text files See :help restore-position function! RemoveTrailingSpaces() exe normal msHmtgg %s/\s\+$//ge exe normal 'tzt`s endfunction au BufWrite * if ! bin | call RemoveTrailingSpaces() | endif The function restores cursor position and does not give any warning because of the 'e' flag. You can do the same things for empty lines.