aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-14 00:10:37 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-14 00:10:37 +1200
commit92a012b81591cfb41009984970af2c4ae27bf809 (patch)
tree91e462237cfbd1d3425ef58400299b5a35b14a57
parentRevert "Use shorter :map commands for diff/mail... (diff)
downloaddotfiles-92a012b81591cfb41009984970af2c4ae27bf809.tar.gz
dotfiles-92a012b81591cfb41009984970af2c4ae27bf809.zip
Consolidate 'backup' and 'backupskip' sections
-rw-r--r--vim/vimrc39
1 files changed, 18 insertions, 21 deletions
diff --git a/vim/vimrc b/vim/vimrc
index a3753493..03892685 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -296,14 +296,11 @@ set history=10000
" Enable automatic backups of most file buffers. In practice, I don't need
" these backups very much if I'm using version control sensibly, but they have
-" still saved my bacon a few times. We're not done here yet, though; there's
-" the important matter of where to *put* those backups.
+" still saved my bacon a few times.
"
-set backup
-
-" We'll try to keep the aforementioned backup files in a dedicated cache
-" directory, to stop them popping up next to the file to which they
-" correspond, and getting committed to version control.
+" We'll try to keep the backup files in a dedicated cache directory, to stop
+" them popping up next to the file to which they correspond, and getting
+" committed to version control.
"
" If Vim is new enough, we'll add two trailing slashes to the path we're
" inserting, which prompts Vim to incorporate the full escaped path of the
@@ -324,6 +321,7 @@ set backup
" It's all so awkward. Surely separate options named something like
" 'backupfullname', 'swapfilefullname' would have been clearer.
"
+set backup
Establish $MYVIM/cache/backup
if has('patch-8.1.251')
set backupdir^=$MYVIM/cache/backup//
@@ -331,20 +329,6 @@ else
set backupdir^=$MYVIM/cache/backup
endif
-" Prior to v8.1.1519, Vim didn't check patterns added to 'backupskip' for
-" uniqueness, so adding the same path repeatedly resulted in duplicate strings
-" in the value. This was due to the absence of the P_NODUP flag for the
-" option's definition in src/option.c in the Vim source code. If we're using
-" a version older than v8.1.1519, we'll need to explicitly reset 'backupskip'
-" to its default value, so that reloading this file doesn't stack up multiple
-" copies of any added paths.
-"
-" <https://github.com/vim/vim/releases/tag/v8.1.1519>
-"
-if !has('patch-8.1.1519')
- set backupskip&
-endif
-
" Files in certain directories on Unix-compatible filesystems should not be
" backed up, for security reasons. This is particularly important if editing
" temporary files created by sudoedit(8). On Unix-like systems, we here add
@@ -355,7 +339,20 @@ endif
" * /usr/tmp: Hard-coded path for sudoedit(8) [1/2]
" * /var/tmp: Hard-coded path for sudoedit(8) [2/2]
"
+" Prior to v8.1.1519, Vim didn't check patterns added to 'backupskip' for
+" uniqueness, so adding the same path repeatedly resulted in duplicate strings
+" in the value. This was due to the absence of the P_NODUP flag for the
+" option's definition in src/option.c in the Vim source code. If we're using
+" a version older than v8.1.1519, we'll need to explicitly reset 'backupskip'
+" to its default value before adding patterns to it, so that reloading this
+" file doesn't stack up multiple copies of any added paths.
+"
+" <https://github.com/vim/vim/releases/tag/v8.1.1519>
+"
if has('unix')
+ if !has('patch-8.1.1519')
+ set backupskip&
+ endif
set backupskip^=/dev/shm/*,/usr/tmp/*,/var/tmp/*
endif