From cc53da2ad77c063948db8f23804cc0db7df7313a Mon Sep 17 00:00:00 2001 From: Sebastian Burschel Date: Sun, 13 Oct 2019 20:30:43 +0200 Subject: [PATCH] Remove trailing whitespaces --- dotfiles/.vimrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dotfiles/.vimrc b/dotfiles/.vimrc index c561a9c..9114d2e 100644 --- a/dotfiles/.vimrc +++ b/dotfiles/.vimrc @@ -253,4 +253,15 @@ set linebreak " Searching with "/": Ignore case if search term is lower case. set smartcase + +" Strip trailing whitespaces on each save +fun! StripTrailingWhitespaces() + let l = line(".") + let c = col(".") + %s/\s\+$//e + call cursor(l, c) +endfun +autocmd BufWritePre * :call StripTrailingWhitespaces() + + colorscheme blackboard