diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-05 19:09:15 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-05 19:09:15 +1200 |
commit | 5d4dcf2806bb4177c44de0f03c48b1374f887b9c (patch) | |
tree | eb0aa02ebbff16780d1e0689b9b317ea05480a08 | |
parent | Revert "Add /tmp to 'backupskip'" (diff) | |
download | dotfiles-5d4dcf2806bb4177c44de0f03c48b1374f887b9c.tar.gz dotfiles-5d4dcf2806bb4177c44de0f03c48b1374f887b9c.zip |
Attempt to imitate 'backupskip' pats in undoskip
-rw-r--r-- | vim/plugin/undoskip.vim | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/vim/plugin/undoskip.vim b/vim/plugin/undoskip.vim index c4a45304..924c01f4 100644 --- a/vim/plugin/undoskip.vim +++ b/vim/plugin/undoskip.vim @@ -9,13 +9,20 @@ if exists('loaded_undoskip') || &compatible || !has('persistent_undo') endif let loaded_undoskip = 1 -" Set the paths to test; can be changed by the user -let g:undoskip_patterns = [ - \ '^/dev/shm/.', - \ '^/tmp/.', - \ '^/usr/tmp/.' - \ '^/var/tmp/.' - \] +" Set default list of patterns to exclude; mirror documented 'backupskip' +" behavior +if !exists('g:undoskip_patterns') + let g:undoskip_patterns = [] + if has('mac') + call add(g:undoskip_patterns, '^/private/tmp/.') + elseif has('unix') + call add(g:undoskip_patterns, '^/tmp/.') + endif + call extend(g:undoskip_patterns, map( + \ filter([$TMPDIR, $TMP, $TEMP], 'v:val !=# '''''), + \ '''\V\^''.escape(v:val, ''\'').''/\.''' + \)) +endif " Internal function returns a local value for 'undofile' function s:CheckUndoSkip() abort |