aboutsummaryrefslogtreecommitdiff
path: root/vim/vimrc
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-27 08:53:11 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-07-01 09:43:38 +1200
commit36d12fab7aee05fe837c8c33d955dfd02bc50202 (patch)
treec2664acbe421e13a01b6a8134414976e84271b10 /vim/vimrc
parentFactor out option split into a function (diff)
downloaddotfiles-36d12fab7aee05fe837c8c33d955dfd02bc50202.tar.gz
dotfiles-36d12fab7aee05fe837c8c33d955dfd02bc50202.zip
Factor out double-escape for opts into function
Diffstat (limited to 'vim/vimrc')
-rw-r--r--vim/vimrc29
1 files changed, 12 insertions, 17 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 1d551835..cf2bc8a6 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -8,6 +8,11 @@ function! s:OptionSplit(string) abort
\ 'substitute(v:val, ''\\,'', '','', ''g'')',
\)
endfunction
+function! s:EscItemExec(string) abort
+ return escape(escape(
+ \ a:string,
+ \ ','), '\ %#|"')
+endfunction
if exists('$MYVIM')
execute 'set runtimepath^='.s:EscItemExec($MYVIM)
else
@@ -24,9 +29,9 @@ let s:backupdir = s:cache.'/backup'
if !isdirectory(s:backupdir)
call mkdir(s:backupdir, 'p', 0700)
endif
-execute 'set backupdir^='.escape(escape(
+execute 'set backupdir^='.s:EscItemExec(
\ s:backupdir.(has('patch-8.1.251') ? '//' : ''),
- \ ','), '\ %#|"')
+ \)
if has('unix')
if !has('patch-8.1.1519')
set backupskip&
@@ -37,18 +42,14 @@ let s:directory = s:cache.'/swap'
if !isdirectory(s:directory)
call mkdir(s:directory, 'p', 0700)
endif
-execute 'set directory^='.escape(escape(
- \ s:directory,
- \ ','), '\ %#|"')
+execute 'set directory^='.s:EscItemExec(s:directory)
if has('persistent_undo')
set undofile
let s:undodir = s:cache.'/undo'
if !isdirectory(s:undodir)
call mkdir(s:undodir, 'p', 0700)
endif
- execute 'set undodir^='.escape(escape(
- \ s:undodir,
- \ ','), '\ %#|"')
+ execute 'set undodir^='.s:EscItemExec(s:undodir)
endif
filetype plugin indent on
function! s:ReloadFileType() abort
@@ -81,20 +82,14 @@ let s:spellfile = s:cache.'/spell/'.join([
\ &encoding,
\ 'add',
\], '.')
-execute 'set spellfile='.escape(escape(
- \ s:spellfile,
- \ ','), '\ %#|"')
+execute 'set spellfile='.s:EscItemExec(s:spellfile)
let &spellcapcheck = '[.?!]\%( \|[\n\r\t]\)'
set dictionary^=/usr/share/dict/words
let s:ref = $MYVIM.'/ref'
let s:dictionary = s:ref.'/dictionary.txt'
-execute 'set dictionary^='.escape(escape(
- \ s:dictionary,
- \ ','), '\ %#|"')
+execute 'set dictionary^='.s:EscItemExec(s:dictionary)
let s:thesaurus = s:ref.'/thesaurus.txt'
-execute 'set thesaurus^='.escape(escape(
- \ s:thesaurus,
- \ ','), '\ %#|"')
+execute 'set thesaurus^='.s:EscItemExec(s:thesaurus)
set comments= commentstring= define= include=
set path-=/usr/include
set autoindent