From http://vim.wikia.com/wiki/Remove_unwanted_spaces
function TrimWhiteSpace()
%s/\s\+$//e
endfunction
autocmd FileWritePre * call TrimWhiteSpace()
autocmd FileAppendPre * call TrimWhiteSpace()
autocmd FilterWritePre * call TrimWhiteSpace()
autocmd BufWritePre * call TrimWhiteSpace()
On :write
the cursor moves to the first non-blank character of the last trimmed line. How can I make it stay in place?