diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-03 02:00:23 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-03 02:00:23 +1200 |
commit | 6ceccd1ef32997625eecb6fd92ab77a8f4546cae (patch) | |
tree | a6aa0528d259db7e835ec1773d2225247dc7b067 | |
parent | Tolerate unset iteration variables (diff) | |
download | dotfiles-6ceccd1ef32997625eecb6fd92ab77a8f4546cae.tar.gz dotfiles-6ceccd1ef32997625eecb6fd92ab77a8f4546cae.zip |
Separate cache runtime behaviour from config
It's a little awkward to conflate them.
-rw-r--r-- | vim/vimrc | 29 |
1 files changed, 16 insertions, 13 deletions
@@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Wed, 29 Apr 2020 02:53:22 UTC +" Last updated: Sat, 02 May 2020 13:59:44 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -103,23 +103,26 @@ endif " We'll use the XDG directories as machine-local configuration and storage. " <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables> " -" Add all the configuration directories to 'runtimepath', and then put the -" cache home at the very front, so that e.g. 'spellfile' gets created in there -" rather than in the configuration directories. +" Add all the configuration directories to 'runtimepath'. " -let s:xdgruntimepaths = xdg#['config']['dirs'] +let s:xdgconfigpaths = xdg#['config']['dirs'] if xdg#['config']['home'] !=# '' - call insert(s:xdgruntimepaths, xdg#['config']['home']) + call insert(s:xdgconfigpaths, xdg#['config']['home']) endif -if xdg#['cache']['home'] !=# '' - call insert(s:xdgruntimepaths, xdg#['cache']['home']) -endif -for s:xdgruntimepath in reverse(s:xdgruntimepaths) +for s:xdgconfigpath in reverse(s:xdgconfigpaths) execute 'set runtimepath^=' - \.option#Escape(option#item#Escape(s:xdgruntimepath)) + \.option#Escape(option#item#Escape(s:xdgconfigpath)) endfor -unlet! s:xdgruntimepath -unlet s:xdgruntimepaths +unlet! s:xdgconfigpath +unlet s:xdgconfigpaths + +" Now put the XDG cache home at the very front, so that e.g. 'spellfile' gets +" created in there rather than in the configuration directories. +" +if xdg#['cache']['home'] !=# '' + execute 'set runtimepath^=' + \.option#Escape(option#item#Escape(xdg#['cache']['home'])) +endif " We need a command to reliably establish a full path, whether or not the " directories already exist. We create a wrapper for the autoloaded function |