diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-06 14:39:52 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-06 14:39:52 +1200 |
commit | 9be57992a9dc91a20b9cc420fc285fab6a32b792 (patch) | |
tree | de794315492683b26c81d93c45fb611dc79e94d2 | |
parent | A couple more abbreviations (diff) | |
download | dotfiles-9be57992a9dc91a20b9cc420fc285fab6a32b792.tar.gz dotfiles-9be57992a9dc91a20b9cc420fc285fab6a32b792.zip |
Use autoload function for escaping :set values
-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 |