Last active
December 6, 2018 21:18
-
-
Save spadin/7216061 to your computer and use it in GitHub Desktop.
Simple function for striping trailing whitespace in Vim.
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
fun! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces() | |
map <Leader>cw :call <SID>StripTrailingWhitespaces()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment