From 967c80555b311611328c0d610defd41b8f36bf9a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 3 May 2020 02:43:02 +1200 Subject: Test dir lists for emptiness to avoid force :unlet --- vim/vimrc | 34 +++++++++++++++++++--------------- 1 file 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 -- cgit v1.2.3 From a58f96bff91ad5b3da9b2de68d7101dee4d43527 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 3 May 2020 03:08:46 +1200 Subject: Factor out iteration variables with some maps --- vim/vimrc | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 2ceed761..b2b720f4 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Sat, 02 May 2020 14:34:52 UTC +" Last updated: Sat, 02 May 2020 15:03:05 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -112,13 +112,12 @@ if xdg#['config']['home'] !=# v:null call insert(s:xdgconfigpaths, xdg#['config']['home']) endif 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 + execute 'set runtimepath^='.option#Escape(join(map( + \ s:xdgconfigpaths, 'option#item#Escape(v:val)' + \), ',')) + execute 'set runtimepath+='.option#Escape(join(map( + \ reverse(s:xdgconfigpaths), 'option#item#Escape(v:val."/after")' + \), ',')) endif unlet s:xdgconfigpaths @@ -126,8 +125,9 @@ unlet s:xdgconfigpaths " 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'])) + 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 @@ -416,13 +416,12 @@ try call insert(s:refdirs, xdg#['data']['home']) endif 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 + execute 'set dictionary^='.option#Escape(join(map( + \ s:refdirs, 'option#item#Escape(v:val."/dictionary.txt")' + \), ',')) + execute 'set thesaurus^='.option#Escape(join(map( + \ s:refdirs, 'option#item#Escape(v:val."/thesaurus.txt")' + \), ',')) endif unlet s:refdirs catch /^Vim\%((\a\+)\)\=:E474:/ -- cgit v1.2.3 From 83ee166ee09737997555e51aa6166bc17df9a214 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 3 May 2020 03:18:06 +1200 Subject: Tighten :try block around 'dictionary'/'thesaurus' --- vim/vimrc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index b2b720f4..a08a4287 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Sat, 02 May 2020 15:03:05 UTC +" Last updated: Sat, 02 May 2020 15:15:57 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -410,22 +410,22 @@ set spellcapcheck=[.?!]\\%(\ \ \\\|[\\n\\r\\t]\\) " 'isfname'; the blacklist is hard-coded. " set dictionary^=/usr/share/dict/words -try - let s:refdirs = xdg#['data']['dirs'] - if xdg#['data']['home'] !=# v:null - call insert(s:refdirs, xdg#['data']['home']) - endif - if !empty(s:refdirs) +let s:refdirs = xdg#['data']['dirs'] +if xdg#['data']['home'] !=# v:null + call insert(s:refdirs, xdg#['data']['home']) +endif +if !empty(s:refdirs) + try execute 'set dictionary^='.option#Escape(join(map( \ s:refdirs, 'option#item#Escape(v:val."/dictionary.txt")' \), ',')) execute 'set thesaurus^='.option#Escape(join(map( \ s:refdirs, 'option#item#Escape(v:val."/thesaurus.txt")' \), ',')) - endif - unlet s:refdirs -catch /^Vim\%((\a\+)\)\=:E474:/ -endtry + catch /^Vim\%((\a\+)\)\=:E474:/ + endtry +endif +unlet s:refdirs " Next, we’ll modernize a little in adjusting some options with old " language-specific defaults. -- cgit v1.2.3 From 225b77a5a5843794e541c00083ab46e29f4028d8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 3 May 2020 03:25:10 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index c7443ec1..74e15306 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v8.24.0 -Sat, 02 May 2020 14:16:31 +0000 +tejr dotfiles v8.25.0 +Sat, 02 May 2020 15:25:10 +0000 -- cgit v1.2.3