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.
