" 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.
" 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.
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