From 3713dc2b6dc6f75db1ee6118d40cdb534cef6ce4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 16:07:24 +1200 Subject: Save &runtimepath split in a variable for later --- vim/vimrc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'vim') 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 $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 -- cgit v1.2.3