diff options
-rw-r--r-- | vim/vimrc | 39 |
1 files changed, 18 insertions, 21 deletions
@@ -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 |