From 568a09a4f1c8948dbcb4f07f4f7fc5b59f6db9bc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 18 Jun 2019 10:26:46 +1200 Subject: Continue faffing around with vimrc conditionals --- vim/vimrc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 10a3aafb..68d30b59 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -118,7 +118,7 @@ endif " Firstly, MYVIM can't be an empty string. We need a real path. " -if $MYVIM ==# '' +if !strlen($MYVIM) echoerr 'Blank user runtime path' finish endif @@ -130,7 +130,7 @@ endif " :execute abstraction, but it's not really worth the extra complexity for " such a niche situation. " -if $MYVIM =~# ',' +if stridx($MYVIM, ',') != -1 echoerr 'Illegal comma in user runtime path' finish endif @@ -149,10 +149,8 @@ endif " " " -if $MYVIM =~# '\\' && ( - \ v:version < 701 - \ || v:version == 701 && !has('patch55') - \ ) +if stridx($MYVIM, '\') != -1 + \ && (v:version < 701 || v:version == 701 && !has('patch55')) echoerr 'Illegal backslash in user runtime path on Vim < v7.1.055' finish endif @@ -825,8 +823,7 @@ set shortmess+=I " plugin doesn't look like it's going to load, whether because plugins have " been disabled, or it's not in any of the plugin directories. " -if !&loadplugins - \ && globpath(&runtimepath, 'plugin/matchparen.vim') !=# '' +if !&loadplugins || !strlen(globpath(&runtimepath, 'plugin/matchparen.vim')) set showmatch matchtime=3 endif @@ -1008,7 +1005,7 @@ autocmd vimrc ColorScheme sahara " environment variable COLORFGBG or a response in v:termrbgresp that would set " it specifically. " -if !exists('$COLORFGBG') && get(v:, 'termrbgresp', '') ==# '' +if !exists('$COLORFGBG') && !strlen(get(v:, 'termrbgresp', '')) set background=dark endif @@ -1018,7 +1015,7 @@ endif " if &background ==# 'dark' \ && (has('gui_running') || &t_Co >= 256) - \ && globpath(&runtimepath, 'colors/sahara.vim') !=# '' + \ && strlen(globpath(&runtimepath, 'colors/sahara.vim')) colorscheme sahara endif @@ -1111,8 +1108,7 @@ nnoremap " If the plugin isn't available, I just abandon CTRL-C to continue its " uselessness. " -if &loadplugins - \ && globpath(&runtimepath, 'plugin/insert_cancel.vim') !=# '' +if &loadplugins && strlen(globpath(&runtimepath, 'plugin/insert_cancel.vim')) imap (InsertCancel) endif -- cgit v1.2.3