Skip to content

Instantly share code, notes, and snippets.

@nerdyness
Created April 17, 2014 03:01
Show Gist options
  • Save nerdyness/10949957 to your computer and use it in GitHub Desktop.
Save nerdyness/10949957 to your computer and use it in GitHub Desktop.
vim shenanigans
" Removes trailing spaces
function TrimWhiteSpace()
:let l:winview = winsaveview()
%s/\s*$//
call winrestview(l:winview)
endfunction
au FileWritePre * :call TrimWhiteSpace()
au FileAppendPre * :call TrimWhiteSpace()
au FilterWritePre * :call TrimWhiteSpace()
au BufWritePre * :call TrimWhiteSpace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment