diff options
-rw-r--r-- | vim/vimrc | 45 |
1 files changed, 29 insertions, 16 deletions
@@ -149,9 +149,10 @@ command! -bang -bar -complete=dir -nargs=1 CreatePath " " <https://github.com/vim/vim/releases/tag/v8.1.0716> " -if xdg#['cache']['home'] !=# '' - execute 'set viminfo+='.option#Escape('n'.xdg#['cache']['home'].'/viminfo') - call path#Create(xdg#['cache']['home']) +if xdg#['cache']['home'] !=# '' && path#Create(xdg#['cache']['home']) + execute 'set viminfo+='.option#Escape( + \ 'n'.xdg#['cache']['home'].'/viminfo' + \) endif " Speaking of recorded data in viminfo files, the default Vim limit of a mere @@ -198,10 +199,13 @@ set history=10000 " set backup if xdg#['cache']['home'] !=# '' - execute 'set backupdir^='.option#Escape(option#item#Escape( - \ xdg#['cache']['home'].'/backup'.(has#('patch-8.1.251') ? '//' : ''), - \)) - call path#Create(xdg#['cache']['home'].'/backup') + let s:backupdir = xdg#['cache']['home'].'/backup' + if path#Create(s:backupdir) + execute 'set backupdir^='.option#Escape(option#item#Escape( + \ s:backupdir.(has#('patch-8.1.251') ? '//' : ''), + \)) + endif + unlet s:backupdir endif " Files in certain directories on Unix-compatible filesystems should not be @@ -240,9 +244,12 @@ endif " if xdg#['cache']['home'] !=# '' let s:directory = xdg#['cache']['home'].'/swap' - execute 'set directory^=' - \.option#Escape(option#item#Escape(s:directory.'//')) - call path#Create(s:directory) + if path#Create(s:directory) + execute 'set directory^='.option#Escape(option#item#Escape( + \ s:directory.'//' + \)) + endif + unlet s:directory endif " Keep tracked undo history for files permanently, in a dedicated cache @@ -262,9 +269,12 @@ if has#('persistent_undo') set undofile if xdg#['cache']['home'] !=# '' let s:undodir = xdg#['cache']['home'].'/undo' - execute 'set undodir^=' - \.option#Escape(option#item#Escape(s:undodir.'//')) - call path#Create(s:undodir) + if path#Create(s:undodir) + execute 'set undodir^='.option#Escape(option#item#Escape( + \ s:undodir.'//' + \)) + endif + unlet s:undodir endif endif @@ -275,9 +285,11 @@ endif " if has#('mksession') && xdg#['cache']['home'] let s:viewdir = xdg#['cache']['home'].'/view' - execute 'set viewdir=' - \.option#Escape(option#item#Escape(s:viewdir)) - call path#Create(s:viewdir) + if path#Create(s:viewdir) + execute 'set viewdir=' + \.option#Escape(option#item#Escape(s:viewdir)) + endif + unlet s:viewdir endif " Now that we have a bit more confidence in our runtime environment, set up @@ -403,6 +415,7 @@ try execute 'set thesaurus^=' \.option#Escape(option#item#Escape(s:refdir.'/thesaurus.txt')) endfor + unlet s:refdirs s:refdir catch /^Vim\%((\a\+)\)\=:E474:/ endtry |