aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vim/autoload/undoskip.vim20
-rw-r--r--vim/plugin/undoskip.vim23
2 files changed, 21 insertions, 22 deletions
diff --git a/vim/autoload/undoskip.vim b/vim/autoload/undoskip.vim
new file mode 100644
index 00000000..8813ff13
--- /dev/null
+++ b/vim/autoload/undoskip.vim
@@ -0,0 +1,20 @@
+" Internal function returns a local value for 'undofile'
+function! undoskip#Check(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
diff --git a/vim/plugin/undoskip.vim b/vim/plugin/undoskip.vim
index 2471d6b0..047d9e10 100644
--- a/vim/plugin/undoskip.vim
+++ b/vim/plugin/undoskip.vim
@@ -27,30 +27,9 @@ if !exists('g:undoskip')
\))
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>'))
+ \ let &l:undofile = undoskip#Check(expand('<amatch>'))
augroup END