aboutsummaryrefslogtreecommitdiff
path: root/vim/vimrc
diff options
context:
space:
mode:
Diffstat (limited to 'vim/vimrc')
-rw-r--r--vim/vimrc69
1 files changed, 39 insertions, 30 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 7d4c0508..ef02a401 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -2,7 +2,7 @@
" Tom Ryder (tejr)’s Literate Vimrc
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
"
-" Last updated: Sat, 18 Jul 2020 15:09:37 UTC
+" Last updated: Sat, 12 Sep 2020 05:21:43 UTC
"
" │ And I was lifted up in heart, and thought
" │ Of all my late-shown prowess in the lists,
@@ -246,31 +246,49 @@ 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
-" a few paths to the default value of 'backupskip' in order to prevent the
-" creation of such undesired backup files.
-"
-" * /dev/shm: RAM disk, default path for password-store’s temporary files
-" * /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>
+" temporary files created by sudoedit(8). We add a few path patterns to the
+" default value of 'backupskip' here, in order to prevent the creation of such
+" undesired backup files.
"
if has#('unix')
+
+ " 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#('patch-8.1.1519')
set backupskip&
endif
- set backupskip^=/dev/shm/*,/usr/tmp/*,/var/tmp/*
+
+ " Typical temporary file locations
+ "" RAM disk, default path for password-store’s temporary files
+ set backupskip+=/dev/shm/*
+ "" Hard-coded paths for sudoedit
+ set backupskip+=/usr/tmp/*,/var/tmp/*
+
+ " Per-repository temporary files for Git
+ "" Commit messages
+ set backupskip+=*.git/*_EDITMSG
+ "" Patch edits
+ set backupskip+=*.git/ADD_EDIT.patch
+ "" Interactive rebase manifests
+ set backupskip+=*.git/rebase-merge/git-rebase-todo
+
+ " systemd user manager unit files
+ "" Full unit files
+ set backupskip+=*/systemd/user/.#?*.?*????????????????
+ "" Per-unit overrides
+ set backupskip+=*/systemd/user/?*.?*.d/.#override.conf????????????????
+
endif
+
" Keep swap files for file buffers in a dedicated directory, rather than the
" default of writing them to the same directory as the buffer file. Add two
" trailing slashes to the path to prompt Vim to use the full escaped path in
@@ -424,8 +442,8 @@ endif
" At some point, I may end up having to set this option along with 'spellfile'
" a bit more intelligently to ensure that spell checking and dictionary
" function consistently, and with reference to the same resources. For the
-" moment, I’ve just added another entry referring to a directory in the user
-" runtime directory, but I don’t have anything distinct to put there yet.
+" moment, I’ve just added additional entries referring to the user runtime
+" directory.
"
" In much the same way, we add an expected path to a thesaurus, for completion
" with CTRL-X CTRL-T in insert mode, or with ‘t’ added to 'completeopt'. The
@@ -436,15 +454,6 @@ endif
" to remove the first two metadata lines from thesaurus.txt, as Vim appeared
" to interpret them as part of the body data.
"
-" Extra checks for appending the 'dictionary' and 'thesaurus' paths need to be
-" made, because the P_NDNAME property is assigned to them, which enforces
-" a character blacklist in the option value. We check for the expected Vim
-" error code here, and if the path offends, we just skip the setting entirely,
-" rather than throwing cryptic errors at the user. None of the blacklisted
-" characters are particularly wise characters to have in paths, anyway, legal
-" though they may be on Unix filesystems. We can’t work around this one with
-" 'isfname'; the blacklist is hard-coded.
-"
set dictionary^=/usr/share/dict/words
if s:xdgdatahome !=# '' || !empty(s:xdgdatadirs)
execute 'set dictionary^='.option#Escape(join(map(