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