aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-03 03:08:46 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-03 03:08:46 +1200
commita58f96bff91ad5b3da9b2de68d7101dee4d43527 (patch)
treed2c64bb41d5577caca04784bf7829aded33696b0
parentTest dir lists for emptiness to avoid force :unlet (diff)
downloaddotfiles-a58f96bff91ad5b3da9b2de68d7101dee4d43527.tar.gz
dotfiles-a58f96bff91ad5b3da9b2de68d7101dee4d43527.zip
Factor out iteration variables with some maps
-rw-r--r--vim/vimrc33
1 files 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:/