Simple function for striping trailing whitespace in Vim.
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