aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vim/plugin/undoskip.vim21
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