summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-10-15 06:50:26 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-10-15 06:50:26 +0200
commitc918836b91269054b674670e95dced99c0606de3 (patch)
tree0cef9299577aa81ec30e423d33ccdcf7b0821022
parentfb96c1fa6e0e34a5efd84209f9656c3276110174 (diff)
downloaddotfiles-c918836b91269054b674670e95dced99c0606de3.tar.gz
dotfiles-c918836b91269054b674670e95dced99c0606de3.tar.bz2
dotfiles-c918836b91269054b674670e95dced99c0606de3.zip
vimrc: Do not highlight trailing space in insert mode
..while on the problematic line
-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()