aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-27 17:19:48 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-07-01 09:43:38 +1200
commitfed2d189e7dcd60f7dbe11c3d50bf85864e3220c (patch)
tree11e4135e79c0576f353fefc5a26d6c83b65235f7
parentPlaying with Unicode characters (diff)
downloaddotfiles-fed2d189e7dcd60f7dbe11c3d50bf85864e3220c.tar.gz
dotfiles-fed2d189e7dcd60f7dbe11c3d50bf85864e3220c.zip
Adopt argument unpacking conventions
-rw-r--r--vim/vimrc11
1 files changed, 6 insertions, 5 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 6877d059..0fdcec3c 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -100,8 +100,7 @@ function! s:OptionSplit(expr, ...) abort
if a:0 > 1
echoerr 'Too many arguments'
endif
- let expr = a:expr
- let keepempty = a:0 ? a:1 : 0
+ let [expr, keepempty] = [a:expr, a:0 ? a:1 : 0]
return map(
\ split(expr, '\\\@<!,[, ]*', keepempty),
\ 'substitute(v:val, ''\\,'', '','', ''g'')',
@@ -113,7 +112,8 @@ endfunction
" escaping necessary for a string that can be used in an :execute wrapper over
" a :set command string.
function! s:EscItemExec(item) abort
- return escape(escape(a:item, ','), '\ %#|"')
+ let [item] = [a:item]
+ return escape(escape(item, ','), '\ %#|"')
endfunction
if exists('$MYVIM')
execute 'set runtimepath^='.s:EscItemExec($MYVIM)
@@ -122,8 +122,9 @@ elseif strlen(&runtimepath) > 0
let $MYVIM = s:runtimepath[0]
endif
function! s:Mkpath(path) abort
- return isdirectory(a:path)
- \ || exists('*mkdir') && mkdir(a:path)
+ let [path] = [a:path]
+ return isdirectory(path)
+ \ || exists('*mkdir') && mkdir(path)
endfunction
let s:cache = $MYVIM.'/cache'
call s:Mkpath(s:cache)