summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/vim/vimrc9
1 files changed, 7 insertions, 2 deletions
diff --git a/.config/vim/vimrc b/.config/vim/vimrc
index 5f972ab..a57dd3e 100644
--- a/.config/vim/vimrc
+++ b/.config/vim/vimrc
@@ -131,7 +131,12 @@ autocmd FileType tex colorscheme delek
set spellfile=$XDG_DATA_HOME/vim/spell.de.add,$XDG_DATA_HOME/vim/spell.en.add
+
highlight ExtraWhitespace ctermbg=red guibg=red
-autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
+match ExtraWhitespace /\s\+$/
" Show trailing whitespace and spaces before a tab:
-match ExtraWhitespace /\s\+$\| \+\ze\t/
+"match ExtraWhitespace /\s\+$\| \+\ze\t/
+autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
+autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
+autocmd InsertLeave * match ExtraWhitespace /\s\+$/
+autocmd BufWinLeave * call clearmatches()