vim: trim trailing spaces
This commit is contained in:
@@ -45,6 +45,17 @@ let g:netrw_winsize = 25
|
||||
call matchadd('colorcolumn', '\%101v', 100)
|
||||
highlight colorcolumn ctermbg=red
|
||||
|
||||
fun! TrimWhitespace()
|
||||
" Skip if the filetype is markdown
|
||||
if &ft =~ 'markdown'
|
||||
return
|
||||
endif
|
||||
let l:save = winsaveview()
|
||||
keeppatterns %s/\s\+$//e
|
||||
call winrestview(l:save)
|
||||
endfun
|
||||
autocmd BufWritePre * call TrimWhitespace()
|
||||
|
||||
" undofile - This allows you to use undos after exiting and restarting
|
||||
" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
|
||||
" :help undo-persistence
|
||||
|
||||
Reference in New Issue
Block a user