From: Simon Ruderich Date: Tue, 29 Nov 2011 14:10:10 +0000 (+0100) Subject: vimrc: Really disable spell checking when diffing. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=a52718a67ac0a600575b992c06804ef6ce76bae5;p=config%2Fdotfiles.git vimrc: Really disable spell checking when diffing. --- diff --git a/vimrc b/vimrc index 5c80473..04d26ca 100644 --- a/vimrc +++ b/vimrc @@ -4,9 +4,12 @@ " EDITOR SETTINGS " Save 'runtimepath' in case it was changed by the system's configuration -" files. +" files. Also save 'diff' as set all& resets it; but somehow later (after +" sourcing the vimrc - for example in a VimEnter autocmd) it gets +" automagically restored to the correct value. if has('eval') let s:save_runtimepath = &runtimepath + let s:save_diff = &diff endif " Reset all options (except 'term', 'lines' and 'columns'). This makes sure a " system wide configuration file doesn't change default values. @@ -14,7 +17,9 @@ set all& " And restore it after all other options were reset. if has('eval') let &runtimepath = s:save_runtimepath + let &diff = s:save_diff unlet s:save_runtimepath + unlet s:save_diff endif " Make sure Vim (and not Vi) settings are used. @@ -111,10 +116,12 @@ endif set ignorecase set smartcase -" Activate spell checking, use English as default. Don't use spell checking -" when diffing. -if exists('+spell') && has('syntax') && !&diff - set spell +" Activate spell checking, use English as default. +if exists('+spell') && has('syntax') + " But not when diffing as spell checking is distracting in this case. + if !&diff + set spell + endif set spelllang=en_us endif