aboutsummaryrefslogtreecommitdiff
path: root/vim/config/syntax.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-29 23:50:23 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-29 23:55:15 +1300
commitac847c00fe46e82e65008b6d23e1f8d89e755232 (patch)
treeadb4c9f0d24bb12488760c51a85faf9c2176d998 /vim/config/syntax.vim
parentUpdate submodules (diff)
downloaddotfiles-ac847c00fe46e82e65008b6d23e1f8d89e755232.tar.gz
dotfiles-ac847c00fe46e82e65008b6d23e1f8d89e755232.zip
Require minimum Vim version for background detect
On an ancient Vim (6.1), the block of code checking the value of COLORFGBG does not work at all, raising the following error output: Error detected while processing function DetectBackground: line 3: E117: Unknown function: split E15: Invalid expression: split($COLORFGBG, ';') line 6: E121: Undefined variable: l:colorfgbg E15: Invalid expression: len(l:colorfgbg) ? l:colorfgbg[-1] : '' line 9: E121: Undefined variable: l:bg E15: Invalid expression: l:bg == 'default' || l:bg == '7' || l:bg == '15' line 11: :else without :if: else line 13: :endif without :if: endif I'm unlikely to need such an ancient Vim very often, so I've simply added an error guard around the block.
Diffstat (limited to 'vim/config/syntax.vim')
-rw-r--r--vim/config/syntax.vim5
1 files changed, 4 insertions, 1 deletions
diff --git a/vim/config/syntax.vim b/vim/config/syntax.vim
index 250ce924..32993572 100644
--- a/vim/config/syntax.vim
+++ b/vim/config/syntax.vim
@@ -7,7 +7,7 @@ if has('syntax')
" Invert Vim's built-in logic for choosing dark or light backgrounds; we'll
" default to choosing a dark background unless we find some reason *not* to.
- if has('eval')
+ if has('eval') && v:version >= 701
" Wrap all this logic in a function
function! DetectBackground()
@@ -30,6 +30,9 @@ if has('syntax')
" Cull the function just defined directly
call DetectBackground()
+ " Ancient or cut-down Vim? Just go dark
+ else
+ set background=dark
endif
endif