aboutsummaryrefslogtreecommitdiff
path: root/vim/vimrc
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-03 02:16:34 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-03 02:16:34 +1200
commitfd7bbd4599d1c15555c8c563d840d7fae6fd60bf (patch)
treee1030e690578e97208d3f96b7ede1ea1c3b7d02f /vim/vimrc
parentMerge branch 'release/v8.23.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-8.24.0.tar.gz (sig)
dotfiles-8.24.0.zip
Merge branch 'release/v8.24.0'v8.24.0
* release/v8.24.0: Use v:null in XDG-related contexts Add handling of "after" subdirs in Vim XDG config Separate cache runtime behaviour from config Tolerate unset iteration variables Improve "absolute path" check for XDG base dirs Tidy and correct XDG var getenv() fallback
Diffstat (limited to 'vim/vimrc')
-rw-r--r--vim/vimrc47
1 files changed, 28 insertions, 19 deletions
diff --git a/vim/vimrc b/vim/vimrc
index d34ce24d..a5814aa7 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -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 14:04:10 UTC
"
" │ And I was lifted up in heart, and thought
" │ Of all my late-shown prowess in the lists,
@@ -103,22 +103,30 @@ 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', including "after"
+" directories to the end of it, in reverse order, forming the desired layers
+" of configuration.
"
-let s:xdgruntimepaths = xdg#['config']['dirs']
-if xdg#['config']['home'] !=# ''
- call insert(s:xdgruntimepaths, xdg#['config']['home'])
+let s:xdgconfigpaths = xdg#['config']['dirs']
+if xdg#['config']['home'] !=# v:null
+ 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))
+ execute 'set runtimepath+='
+ \.option#Escape(option#item#Escape(s:xdgconfigpath.'/after'))
endfor
-unlet s:xdgruntimepaths s:xdgruntimepath
+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'] !=# v:null
+ 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
@@ -145,7 +153,7 @@ command! -bang -bar -complete=dir -nargs=1 CreatePath
" 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 xdg#['cache']['home'] !=# '' && path#Create(xdg#['cache']['home'])
+if xdg#['cache']['home'] !=# v:null && path#Create(xdg#['cache']['home'])
execute 'set viminfo+='.option#Escape(
\ 'n'.xdg#['cache']['home'].'/viminfo'
\)
@@ -194,7 +202,7 @@ set history=10000
" 'backupfullname', 'swapfilefullname' would have been clearer.
"
set backup
-if xdg#['cache']['home'] !=# ''
+if xdg#['cache']['home'] !=# v:null
let s:backupdir = xdg#['cache']['home'].'/backup'
if path#Create(s:backupdir)
execute 'set backupdir^='.option#Escape(option#item#Escape(
@@ -238,7 +246,7 @@ endif
" option has supported that hint for much longer than 'backupdir' has. We
" apply path#Create() to attempt to create the path, if needed.
"
-if xdg#['cache']['home'] !=# ''
+if xdg#['cache']['home'] !=# v:null
let s:directory = xdg#['cache']['home'].'/swap'
if path#Create(s:directory)
execute 'set directory^='.option#Escape(option#item#Escape(
@@ -263,7 +271,7 @@ endif
"
if has#('persistent_undo')
set undofile
- if xdg#['cache']['home'] !=# ''
+ if xdg#['cache']['home'] !=# v:null
let s:undodir = xdg#['cache']['home'].'/undo'
if path#Create(s:undodir)
execute 'set undodir^='.option#Escape(option#item#Escape(
@@ -402,7 +410,7 @@ set spellcapcheck=[.?!]\\%(\ \ \\\|[\\n\\r\\t]\\)
set dictionary^=/usr/share/dict/words
try
let s:refdirs = xdg#['data']['dirs']
- if xdg#['data']['home'] !=# ''
+ if xdg#['data']['home'] !=# v:null
call insert(s:refdirs, xdg#['data']['home'])
endif
for s:refdir in reverse(s:refdirs)
@@ -411,7 +419,8 @@ try
execute 'set thesaurus^='
\.option#Escape(option#item#Escape(s:refdir.'/thesaurus.txt'))
endfor
- unlet s:refdirs s:refdir
+ unlet! s:refdir
+ unlet s:refdirs
catch /^Vim\%((\a\+)\)\=:E474:/
endtry