I have the following autocommand, which basically strips whitespace at the end of each line. Unfortunately, at each save, it inserts a step into the undo to jump to the beginning to the file, which is quite annoying. Is there a way to make vim ignore jumping around in the following command, so that undoing keeps the cursor in position?
autocmd BufWritePre * \ let s:bufwritepre_currline = line('.') | \ let s:bufwritepre_currcol = col('.') | \ silent %s/\s*$// | \ call cursor(s:bufwritepre_currline, s:bufwritepre_currcol)