aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vim/vimrc21
1 files changed, 11 insertions, 10 deletions
diff --git a/vim/vimrc b/vim/vimrc
index fb5fe383..b1d8faf7 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -58,8 +58,9 @@
"
" Vim, I love you, but you are so weird.
"
-if !exists('$MYVIM') && &runtimepath !=# ''
- let $MYVIM = split(&runtimepath, '\\\@<!,[, ]*')[0]
+let runtimepath = split(&runtimepath, '\\\@<!,[, ]*')
+if !exists('$MYVIM') && len(runtimepath) > 0
+ let $MYVIM = runtimepath[0]
endif
" We need to check the MYVIM environment variable's value to ensure it's not
@@ -86,6 +87,14 @@ elseif v:version < 702 && $MYVIM =~# '\\'
let $MYVIM = ''
endif
+" If the MYVIM environment variable was set outside Vim, it may not correspond
+" to the first element of the default &runtimepath. If this is the case,
+" we'll slot it in, having already checked it for troublesome characters.
+"
+if $MYVIM !=# runtimepath[0]
+ set runtimepath^=$MYVIM
+endif
+
" We're going to be creating a few directories, and the code to do so in
" a compatible way is surprisingly verbose, because we need to check the
" mkdir() function is actually available, and also whether the directory
@@ -121,14 +130,6 @@ if $MYVIM !=# ''
EnsureDir $MYVIM
endif
-" If the MYVIM environment variable was set outside Vim, it may not correspond
-" to the first element of the default &runtimepath. If this is the case,
-" we'll slot it in, having already checked it for troublesome characters.
-"
-if $MYVIM !=# s:SplitOption(&runtimepath)[0]
- set runtimepath^=$MYVIM
-endif
-
" Create a 'vimrc' automatic command hook group, if it already exists, and
" clear away any automatic command hooks already defined within it if it does,
" so that we don't end up collecting multiple copies of the hooks configured