From 7be1e55f10bb01679134aacb760f02642fba27cd Mon Sep 17 00:00:00 2001 From: Duncan de Wet Date: Fri, 18 Oct 2013 21:56:20 +1300 Subject: [PATCH] Stop the script from double execution with a "loaded" variable --- plugin/trailing-whitespace.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugin/trailing-whitespace.vim b/plugin/trailing-whitespace.vim index 5688ef4..5edc29b 100644 --- a/plugin/trailing-whitespace.vim +++ b/plugin/trailing-whitespace.vim @@ -1,8 +1,12 @@ +if exists('loaded_trailing_whitespace_plugin') | finish | endif +let loaded_trailing_whitespace_plugin = 1 + " Highlight EOL whitespace, http://vim.wikia.com/wiki/Highlight_unwanted_spaces highlight ExtraWhitespace ctermbg=darkred guibg=#382424 autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ -" the above flashes annoyingly while typing, be calmer in insert mode + +" The above flashes annoyingly while typing, be calmer in insert mode autocmd InsertLeave * match ExtraWhitespace /\s\+$/ autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@FixWhitespace(,) -