* Eric Leenman [2007.03.30 06:45]: > 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?
:%s/^\n\{2,}// > And how do you give this command just before > closing the file? One way is to use autocommands. :au BufLeave * :%s/^\n\{2,}// Note that this implementation will give you a warning if the pattern is not found. See :h autocmd-events if BufLeave isn't exactly what you want, :h autocmd-patterns if * isn't exactly the file pattern you want, or :h autocommand For the general discussion. -- JR