diff options
-rw-r--r-- | vim/autoload/vimrc.vim | 5 | ||||
-rw-r--r-- | vim/vimrc | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/vim/autoload/vimrc.vim b/vim/autoload/vimrc.vim index bfbae263..5f378bde 100644 --- a/vim/autoload/vimrc.vim +++ b/vim/autoload/vimrc.vim @@ -1,3 +1,8 @@ +" Escape a text value for inclusion in a comma-separated option value +function! vimrc#EscapeSet(string) + return escape(a:string, '\ ,') +endfunction + " Split a string with a split character that can be escaped with another, " e.g. &runtimepath with commas and backslashes respectively function! vimrc#SplitEscaped(str, ...) abort @@ -24,7 +24,7 @@ set backspace+=start " Before the start of current insertion " Keep backup files in dedicated directory; add trailing double-slash to keep " full path in name, if Vim is new enough to support that set backup -execute 'set backupdir^='.escape($MYVIM, '\ ').'/cache/backup' +execute 'set backupdir^='.vimrc#EscapeSet($MYVIM).'/cache/backup' \ . (vimrc#Version('8.1.251') ? '//' : '') " Add some *nix paths not to back up @@ -179,7 +179,7 @@ let $VIMINFO = $MYVIM.'/cache/viminfo' if exists('+viminfofile') " Use new option method if we can (v8.1.716) set viminfofile=$VIMINFO else " Resort to clunkier method with 'viminfo' option flag - execute 'set viminfo+=n'.escape($VIMINFO, '\ ') + execute 'set viminfo+=n'.vimrc#EscapeSet($VIMINFO) endif " Let me move beyond buffer text in visual block mode |