From 0a7d8e7fdc5e47ccfec42386de3a4cfbb35ffbd1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 5 May 2020 19:54:48 +1200 Subject: Pass paths correctly in undoskip.vim --- vim/plugin/undoskip.vim | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/vim/plugin/undoskip.vim b/vim/plugin/undoskip.vim index af66f480..2471d6b0 100644 --- a/vim/plugin/undoskip.vim +++ b/vim/plugin/undoskip.vim @@ -28,7 +28,7 @@ if !exists('g:undoskip') endif " Internal function returns a local value for 'undofile' -function s:CheckUndoSkip() abort +function s:CheckUndoSkip(path) abort " If this isn't a normal buffer, don't save undo data if &buftype !=# '' @@ -37,9 +37,8 @@ function s:CheckUndoSkip() abort " Get the path from the buffer name; if that path matches any of the " patterns, don't save undo data - let path = bufname('%') for glob in g:undoskip - if path =~# glob2regpat(glob) + if a:path =~# glob2regpat(glob) return 0 endif endfor @@ -49,13 +48,9 @@ function s:CheckUndoSkip() abort endfunction -" Command interface into the private function's value, does the actual set -command -nargs=0 CheckUndoSkip - \ let &l:undofile = s:CheckUndoSkip() - " Check the path on every buffer rename, create, or read augroup undoskip autocmd! autocmd BufAdd,BufNewFile,BufRead * - \ CheckUndoSkip + \ let &l:undofile = s:CheckUndoSkip(expand('')) augroup END -- cgit v1.2.3