Skip to content

Instantly share code, notes, and snippets.

@andreapavoni
Created December 7, 2011 13:24
Show Gist options
  • Save andreapavoni/1442780 to your computer and use it in GitHub Desktop.
Save andreapavoni/1442780 to your computer and use it in GitHub Desktop.
vim: clear whitespaces when saving buffer
" clear whitespaces when saving buffer
" put it in your .vimrc
function! Clear_whitespaces()
ma a
:%s/\s\+$//e
'a
endfunction
autocmd BufWritePre * :call Clear_whitespaces()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment