aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-05 21:38:30 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-05 21:38:30 +1200
commit091f895ed97b10660b0492d37029e3364b8a6f23 (patch)
tree3c039eb23706540654d2d302c932eefb82dc8864
parentMerge branch 'hotfix/v8.29.1' into develop (diff)
downloaddotfiles-091f895ed97b10660b0492d37029e3364b8a6f23.tar.gz
dotfiles-091f895ed97b10660b0492d37029e3364b8a6f23.zip
Move undoskip.vim function into autoload
Ready to be spun off now I think
-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