From 091f895ed97b10660b0492d37029e3364b8a6f23 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 5 May 2020 21:38:30 +1200 Subject: Move undoskip.vim function into autoload Ready to be spun off now I think --- vim/autoload/undoskip.vim | 20 ++++++++++++++++++++ vim/plugin/undoskip.vim | 23 +---------------------- 2 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 vim/autoload/undoskip.vim 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('')) + \ let &l:undofile = undoskip#Check(expand('')) augroup END -- cgit v1.2.3 From 3f0b1d25cd5c2f917fa358f0cda00e4c9bc2c40a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 5 May 2020 22:16:03 +1200 Subject: Spin undoskip.vim out into its own repository --- .gitmodules | 3 +++ vim/autoload/undoskip.vim | 20 -------------------- vim/bundle/undoskip | 1 + vim/plugin/undoskip.vim | 35 ----------------------------------- 4 files changed, 4 insertions(+), 55 deletions(-) delete mode 100644 vim/autoload/undoskip.vim create mode 160000 vim/bundle/undoskip delete mode 100644 vim/plugin/undoskip.vim diff --git a/.gitmodules b/.gitmodules index 92fe319f..ed120bfd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -77,6 +77,9 @@ [submodule "vim/bundle/toggle_flags"] path = vim/bundle/toggle_flags url = https://sanctum.geek.nz/code/vim-toggle-flags.git +[submodule "vim/bundle/undoskip"] + path = vim/bundle/undoskip + url = https://sanctum.geek.nz/code/vim-undoskip.git [submodule "vim/bundle/vertical_region"] path = vim/bundle/vertical_region url = https://sanctum.geek.nz/code/vim-vertical-region.git diff --git a/vim/autoload/undoskip.vim b/vim/autoload/undoskip.vim deleted file mode 100644 index 8813ff13..00000000 --- a/vim/autoload/undoskip.vim +++ /dev/null @@ -1,20 +0,0 @@ -" 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/bundle/undoskip b/vim/bundle/undoskip new file mode 160000 index 00000000..d0e9d6b4 --- /dev/null +++ b/vim/bundle/undoskip @@ -0,0 +1 @@ +Subproject commit d0e9d6b498a7a98951e6ad7717ea77d749e30f7c diff --git a/vim/plugin/undoskip.vim b/vim/plugin/undoskip.vim deleted file mode 100644 index 047d9e10..00000000 --- a/vim/plugin/undoskip.vim +++ /dev/null @@ -1,35 +0,0 @@ -" -" undoskip.vim: Don't save undo history for temporary or secure files. -" -" Author: Tom Ryder -" 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 - -" Check the path on every buffer rename, create, or read -augroup undoskip - autocmd! - autocmd BufAdd,BufNewFile,BufRead * - \ let &l:undofile = undoskip#Check(expand('')) -augroup END -- cgit v1.2.3 From 6e1b3ac0060f24bb84746a99bb12c0f445e972f6 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 5 May 2020 22:51:13 +1200 Subject: Update spellfile_local.vim HEAD --- vim/bundle/spellfile_local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/bundle/spellfile_local b/vim/bundle/spellfile_local index 16dbdc90..1b42457d 160000 --- a/vim/bundle/spellfile_local +++ b/vim/bundle/spellfile_local @@ -1 +1 @@ -Subproject commit 16dbdc90b39c1ebf43ca1881a493edc816d2d9fa +Subproject commit 1b42457d9024745c2990583c90dc39c448f11e1f -- cgit v1.2.3 From eb9468f79b76e0f86537aeaf7cfbca8426953f58 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 5 May 2020 23:13:10 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index d22ac1a3..7feda192 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v8.29.1 -Tue, 05 May 2020 07:54:17 +0000 +tejr dotfiles v8.30.0 +Tue, 05 May 2020 11:13:10 +0000 -- cgit v1.2.3