Removes trailing spaces automatically

This commit is contained in:
Mattis DALLEAU
2020-06-28 10:52:19 +00:00
parent d8895a34cf
commit 01c3d3abac

14
.vimrc
View File

@@ -188,4 +188,18 @@ set guioptions-=L "remove left-hand scroll bar
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set fillchars+=vert:\
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"=> Trailing spaces
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! CleanExtraSpaces() "Function to clean unwanted spaces
let save_cursor = getpos(".")
let old_query = getreg('/')
silent! %s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfun
autocmd BufWritePre * :call CleanExtraSpaces()