1
0
Fork 0
mirror of synced 2024-12-21 14:31:06 -05:00
This commit is contained in:
amix 2017-04-01 14:12:35 +02:00
parent bbd0e816ca
commit 04ce579f61

View file

@ -299,14 +299,18 @@ if has("mac") || has("macunix")
vmap <D-k> <M-k> vmap <D-k> <M-k>
endif endif
" Delete trailing white space on save, useful for Python and CoffeeScript ;) " Delete trailing white space on save, useful for some filetypes ;)
func! DeleteTrailingWS() fun! CleanExtraSpaces()
exe "normal mz" let save_cursor = getpos(".")
%s/\s\+$//ge let old_query = getreg('/')
exe "normal `z" silent! %s/\s\+$//e
endfunc call setpos('.', save_cursor)
autocmd BufWrite *.py :call DeleteTrailingWS() call setreg('/', old_query)
autocmd BufWrite *.coffee :call DeleteTrailingWS() endfun
if has("autocmd")
autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces()
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""