aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/undoskip.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-05 23:13:14 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-05 23:13:14 +1200
commitb74b01d8a4a6ed9c7a21e4b2ae84307a4773ea0e (patch)
treeaa0dac6dad6f561857a99f7f16b32d6c9c26b5d9 /vim/plugin/undoskip.vim
parentMerge branch 'hotfix/v8.29.1' (diff)
parentBump VERSION (diff)
downloaddotfiles-b74b01d8a4a6ed9c7a21e4b2ae84307a4773ea0e.tar.gz
dotfiles-b74b01d8a4a6ed9c7a21e4b2ae84307a4773ea0e.zip
Merge branch 'release/v8.30.0'v8.30.0
* release/v8.30.0: Update spellfile_local.vim HEAD Spin undoskip.vim out into its own repository Move undoskip.vim function into autoload
Diffstat (limited to 'vim/plugin/undoskip.vim')
-rw-r--r--vim/plugin/undoskip.vim56
1 files changed, 0 insertions, 56 deletions
diff --git a/vim/plugin/undoskip.vim b/vim/plugin/undoskip.vim
deleted file mode 100644
index 2471d6b0..00000000
--- a/vim/plugin/undoskip.vim
+++ /dev/null
@@ -1,56 +0,0 @@
-"
-" undoskip.vim: Don't save undo history for temporary or secure files.
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('loaded_undoskip') || &compatible
- finish
-endif
-if !has('persistent_undo') || !exists('*glob2regpat')
- finish
-endif
-let loaded_undoskip = 1
-
-" Set default list of patterns to exclude; mirror documented 'backupskip'
-" behavior
-if !exists('g:undoskip')
- let g:undoskip = []
- if has('mac')
- call add(g:undoskip, '/private/tmp/*')
- elseif has('unix')
- call add(g:undoskip, '/tmp/*')
- endif
- call extend(g:undoskip, map(
- \ filter([$TMPDIR, $TMP, $TEMP], 'v:val !=# '''''),
- \ 'v:val.''/*'''
- \))
-endif
-
-" Internal function returns a local value for 'undofile'
-function s:CheckUndoSkip(path) abort
-
- " If this isn't a normal buffer, don't save undo data
- if &buftype !=# ''
- return 0
- endif
-
- " Get the path from the buffer name; if that path matches any of the
- " patterns, don't save undo data
- for glob in g:undoskip
- if a:path =~# glob2regpat(glob)
- return 0
- endif
- endfor
-
- " Otherwise, we'll use whatever the global setting is
- return &g:undofile
-
-endfunction
-
-" Check the path on every buffer rename, create, or read
-augroup undoskip
- autocmd!
- autocmd BufAdd,BufNewFile,BufRead *
- \ let &l:undofile = s:CheckUndoSkip(expand('<amatch>'))
-augroup END