Last active
August 29, 2015 14:16
-
-
Save vjo/1453c5c580c06313f571 to your computer and use it in GitHub Desktop.
Vim - Stripping whitespace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" This will work: | |
autocmd BufWritePre *.js,*.py :%s/\s\+$//e | |
" This works too: | |
func! DeleteTrailingWS() | |
exe "normal mz" | |
%s/\s\+$//ge | |
exe "normal `z" | |
endfunc | |
autocmd BufWrite *.* call DeleteTrailingWS() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment