aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-08 20:35:59 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-08 20:35:59 +1200
commitc294bc81d656c43d00e3d4a7d8dd9f6300b866cc (patch)
tree27d86bb8db9f223cf3c0ee26b72543ab4a483f51
parentReverse overzealous factoring out of variable (diff)
downloaddotfiles-c294bc81d656c43d00e3d4a7d8dd9f6300b866cc.tar.gz
dotfiles-c294bc81d656c43d00e3d4a7d8dd9f6300b866cc.zip
Adjust 'backupdir' path specification for clarity
-rw-r--r--vim/vimrc13
1 files changed, 9 insertions, 4 deletions
diff --git a/vim/vimrc b/vim/vimrc
index a43c63e0..5cc14f01 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -96,11 +96,16 @@ set backup
" people assumed it would work the same way, when in fact Vim simply ignored
" it until v8.1.251.
"
-" I think options named something like 'backuppath', 'swapfilepath', and
-" 'undopath' would be much clearer.
+" I don't want to add the slashes to the option value in older versions of Vim
+" where they don't do anything, so I check the version before I add them.
"
-let s:backup_full_path = vimrc#Version('8.1.251')
-let s:backupdir = $MYVIM.'/cache/backup'.(s:backup_full_path ? '//' : '')
+" It's all so awkward. Surely options named something like 'backupfullpath',
+" 'swapfilefullpath', and 'undofullpath' would have been clearer.
+"
+let s:backupdir = $MYVIM.'/cache/backup'
+if vimrc#Version('8.1.251')
+ let s:backupdir .= '//'
+endif
execute 'set backupdir^='.vimrc#EscapeSetPart(s:backupdir)
" Create the first path in the 'backupdir' list, the one we just added, if it