aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-11-19 20:58:03 +1300
committerTom Ryder <tom@sanctum.geek.nz>2020-11-19 20:58:03 +1300
commitf0af3c0f323ac33ea66691bdebb8d4e26f14ff66 (patch)
treeae2b46fcf81fee80634235d5db1b319cda94041e
parentMerge branch 'release/v10.19.0' into develop (diff)
downloaddotfiles-f0af3c0f323ac33ea66691bdebb8d4e26f14ff66.tar.gz
dotfiles-f0af3c0f323ac33ea66691bdebb8d4e26f14ff66.zip
Don't set XDG vars if not running under Unix
-rw-r--r--vim/vimrc43
1 files changed, 24 insertions, 19 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 425a1d5b..0424fca2 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -2,7 +2,7 @@
" Tom Ryder (tejr)’s Literate Vimrc
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
"
-" Last updated: Fri, 23 Oct 2020 08:28:38 UTC
+" Last updated: Thu, 19 Nov 2020 07:55:42 UTC
"
" │ And I was lifted up in heart, and thought
" │ Of all my late-shown prowess in the lists,
@@ -137,16 +137,18 @@ let $MYVIM = option#Split(&runtimepath)[0]
" both the XDG_CONFIG_HOME and XDG_CONFIG_DIRS variables, or from their
" defaults, using autoloaded xdg# functions.
"
-let s:xdgcachehome
- \ = xdg#CacheHome()
-let s:xdgconfigdirs
- \ = xdg#ConfigDirs()
-let s:xdgconfighome
- \ = xdg#ConfigHome()
-let s:xdgdatadirs
- \ = xdg#DataDirs()
-let s:xdgdatahome
- \ = xdg#DataHome()
+if has('unix')
+ let s:xdgcachehome
+ \ = xdg#CacheHome()
+ let s:xdgconfigdirs
+ \ = xdg#ConfigDirs()
+ let s:xdgconfighome
+ \ = xdg#ConfigHome()
+ let s:xdgdatadirs
+ \ = xdg#DataDirs()
+ let s:xdgdatahome
+ \ = xdg#DataHome()
+endif
" We put XDG_CONFIG_HOME at the front of the 'runtimepath' list with insert(),
" provided it isn't empty, which is what the function returns when the
@@ -161,7 +163,8 @@ let s:xdgdatahome
"
" Ours not to reason why…
"
-if s:xdgconfighome !=# '' || !empty(s:xdgconfigdirs)
+if exists('s:xdgconfighome') && s:xdgconfighome !=# ''
+ \ || exists('s:xdgconfigdirs') && !empty(s:xdgconfigdirs)
execute 'set runtimepath^='.option#Escape(join(map(
\ extend(
\ s:xdgconfighome !=# '' ? [s:xdgconfighome] : [],
@@ -188,7 +191,7 @@ endif
" v8.1.716 introduced a way to set this with an option named 'viminfofile',
" but I don't see a reason to use that.
"
-if s:xdgcachehome !=# ''
+if exists('s:xdgcachehome') && s:xdgcachehome !=# ''
if !isdirectory(s:xdgcachehome)
call mkdir(s:xdgcachehome, 'p', 0700)
endif
@@ -238,7 +241,7 @@ set history=300
" 'backupfullname', 'swapfilefullname' would have been clearer.
"
set backup
-if s:xdgcachehome !=# ''
+if exists('s:xdgcachehome') && s:xdgcachehome !=# ''
if !isdirectory(s:xdgcachehome.'/backup')
call mkdir(s:xdgcachehome.'/backup', 'p', 0700)
endif
@@ -299,7 +302,7 @@ endif
" its name, in order to avoid filename collisions, since the 'directory'
" option has supported that hint for much longer than 'backupdir' has.
"
-if s:xdgcachehome !=# ''
+if exists('s:xdgcachehome') && s:xdgcachehome !=# ''
if !isdirectory(s:xdgcachehome.'/swap')
call mkdir(s:xdgcachehome.'/swap', 'p', 0700)
endif
@@ -320,7 +323,7 @@ endif
" Support for these persistent undo file caches was not released until v7.3.0,
" so we need to check for the feature’s presence before we enable it.
"
-if s:xdgcachehome !=# '' && has('persistent_undo')
+if exists('s:xdgcachehome') && s:xdgcachehome !=# '' && has('persistent_undo')
set undofile
if !isdirectory(s:xdgcachehome.'/undo')
call mkdir(s:xdgcachehome.'/undo', 'p', 0700)
@@ -335,7 +338,7 @@ endif
" directories of this type. This isn't a comma-separated list like the others
" ('backupdir', 'directory', 'spell', 'undodir')
"
-if s:xdgcachehome !=# '' && has('mksession')
+if exists('s:xdgcachehome') && s:xdgcachehome !=# '' && has('mksession')
if !isdirectory(s:xdgcachehome.'/view')
call mkdir(s:xdgcachehome.'/view', 'p', 0700)
endif
@@ -442,7 +445,8 @@ endif
" directory.
"
set dictionary^=/usr/share/dict/words
-if s:xdgdatahome !=# '' || !empty(s:xdgdatadirs)
+if exists('s:xdgdatahome') && s:xdgdatahome !=# ''
+ \ || exists('s:xdgdatadirs') && !empty(s:xdgdatadirs)
execute 'set dictionary^='.option#Escape(join(map(
\ extend(
\ s:xdgdatahome !=# '' ? [s:xdgdatahome] : [],
@@ -461,7 +465,8 @@ endif
" WordNet and MyThes-1. I had to remove the first two metadata lines from
" thesaurus.txt, as Vim appeared to interpret them as part of the body data.
"
-if s:xdgdatahome !=# '' || !empty(s:xdgdatadirs)
+if exists('s:xdgdatahome') && s:xdgdatahome !=# ''
+ \ || exists('s:xdgdatadirs') && !empty(s:xdgdatadirs)
execute 'set thesaurus^='.option#Escape(join(map(
\ extend(
\ s:xdgdatahome !=# '' ? [s:xdgdatahome] : [],