mirror of
1
0
Fork 0
This commit is contained in:
amix 2017-04-01 14:12:35 +02:00
parent bbd0e816ca
commit 04ce579f61
1 changed files with 12 additions and 8 deletions

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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""