aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-03 02:43:02 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-03 02:43:02 +1200
commit967c80555b311611328c0d610defd41b8f36bf9a (patch)
treeaf2f769f9ce1ce10e4d1f60696ab14ff8fcecd5c
parentMerge branch 'release/v8.24.0' into develop (diff)
downloaddotfiles-967c80555b311611328c0d610defd41b8f36bf9a.tar.gz
dotfiles-967c80555b311611328c0d610defd41b8f36bf9a.zip
Test dir lists for emptiness to avoid force :unlet
-rw-r--r--vim/vimrc34
1 files changed, 19 insertions, 15 deletions
diff --git a/vim/vimrc b/vim/vimrc
index a5814aa7..2ceed761 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -2,7 +2,7 @@
" Tom Ryder (tejr)’s Literate Vimrc
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
"
-" Last updated: Sat, 02 May 2020 14:04:10 UTC
+" Last updated: Sat, 02 May 2020 14:34:52 UTC
"
" │ And I was lifted up in heart, and thought
" │ Of all my late-shown prowess in the lists,
@@ -111,13 +111,15 @@ let s:xdgconfigpaths = xdg#['config']['dirs']
if xdg#['config']['home'] !=# v:null
call insert(s:xdgconfigpaths, xdg#['config']['home'])
endif
-for s:xdgconfigpath in reverse(s:xdgconfigpaths)
- execute 'set runtimepath^='
- \.option#Escape(option#item#Escape(s:xdgconfigpath))
- execute 'set runtimepath+='
- \.option#Escape(option#item#Escape(s:xdgconfigpath.'/after'))
-endfor
-unlet! s:xdgconfigpath
+if !empty(s:xdgconfigpaths)
+ for s:xdgconfigpath in reverse(s:xdgconfigpaths)
+ execute 'set runtimepath^='
+ \.option#Escape(option#item#Escape(s:xdgconfigpath))
+ execute 'set runtimepath+='
+ \.option#Escape(option#item#Escape(s:xdgconfigpath.'/after'))
+ endfor
+ unlet s:xdgconfigpath
+endif
unlet s:xdgconfigpaths
" Now put the XDG cache home at the very front, so that e.g. 'spellfile' gets
@@ -413,13 +415,15 @@ try
if xdg#['data']['home'] !=# v:null
call insert(s:refdirs, xdg#['data']['home'])
endif
- for s:refdir in reverse(s:refdirs)
- execute 'set dictionary^='
- \.option#Escape(option#item#Escape(s:refdir.'/dictionary.txt'))
- execute 'set thesaurus^='
- \.option#Escape(option#item#Escape(s:refdir.'/thesaurus.txt'))
- endfor
- unlet! s:refdir
+ if !empty(s:refdirs)
+ for s:refdir in reverse(s:refdirs)
+ execute 'set dictionary^='
+ \.option#Escape(option#item#Escape(s:refdir.'/dictionary.txt'))
+ execute 'set thesaurus^='
+ \.option#Escape(option#item#Escape(s:refdir.'/thesaurus.txt'))
+ endfor
+ unlet s:refdir
+ endif
unlet s:refdirs
catch /^Vim\%((\a\+)\)\=:E474:/
endtry