diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-27 08:52:53 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-07-01 09:43:38 +1200 |
commit | 55e0b6d4cb731fd9e4a4ef058c373374794a9ee1 (patch) | |
tree | b4db55083f532de529f22064e2fc2071ab6d2884 /vim/vimrc | |
parent | Stripped all comments, refactored directories (diff) | |
download | dotfiles-55e0b6d4cb731fd9e4a4ef058c373374794a9ee1.tar.gz dotfiles-55e0b6d4cb731fd9e4a4ef058c373374794a9ee1.zip |
Factor out option split into a function
Diffstat (limited to 'vim/vimrc')
-rw-r--r-- | vim/vimrc | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -2,15 +2,17 @@ if !exists('$LANG') && &encoding ==# 'latin1' set encoding=utf-8 endif scriptencoding utf-8 -if exists('$MYVIM') - execute 'set runtimepath^='.escape(escape( - \ $MYVIM, - \ ','), '\ %#|"') -else - let $MYVIM = map( +function! s:OptionSplit(string) abort + return map( \ split(&runtimepath, '\\\@<!,[, ]*'), \ 'substitute(v:val, ''\\,'', '','', ''g'')', - \)[0] + \) +endfunction +if exists('$MYVIM') + execute 'set runtimepath^='.s:EscItemExec($MYVIM) +else + let s:runtimepath = s:OptionSplit(&runtimepath) + let $MYVIM = s:runtimepath[0] endif let s:cache = $MYVIM.'/cache' if !isdirectory(s:cache) |