From 288978a011ce1515431ae58b4759722207a7739c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 May 2020 21:16:56 +1200 Subject: Rename plugin In order to better reflect 'backupskip', the name should be 'undofileskip', not 'undoskip'. After all, the undo feature isn't removed, only its persistence. --- README.md | 4 ++-- autoload/undofileskip.vim | 20 ++++++++++++++++++++ autoload/undoskip.vim | 20 -------------------- doc/undofileskip.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ doc/undoskip.txt | 42 ------------------------------------------ plugin/undofileskip.vim | 35 +++++++++++++++++++++++++++++++++++ plugin/undoskip.vim | 35 ----------------------------------- 7 files changed, 99 insertions(+), 99 deletions(-) create mode 100644 autoload/undofileskip.vim delete mode 100644 autoload/undoskip.vim create mode 100644 doc/undofileskip.txt delete mode 100644 doc/undoskip.txt create mode 100644 plugin/undofileskip.vim delete mode 100644 plugin/undoskip.vim diff --git a/README.md b/README.md index f574b05..b8b9211 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -undoskip.vim -============ +undofileskip.vim +================ This plugin emulates the `'backupskip'` option's functionality for the `+persistent_undo` feature, checking buffer file paths against a list of globs, diff --git a/autoload/undofileskip.vim b/autoload/undofileskip.vim new file mode 100644 index 0000000..62933d8 --- /dev/null +++ b/autoload/undofileskip.vim @@ -0,0 +1,20 @@ +" Internal function returns a local value for 'undofile' +function! undofileskip#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:undofileskip + 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/autoload/undoskip.vim b/autoload/undoskip.vim deleted file mode 100644 index 8813ff1..0000000 --- a/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/doc/undofileskip.txt b/doc/undofileskip.txt new file mode 100644 index 0000000..dcad260 --- /dev/null +++ b/doc/undofileskip.txt @@ -0,0 +1,42 @@ +*undofileskip.txt* For Vim version 8.0 Last change: 2020 May 5 + +DESCRIPTION *undofileskip* + +This plugin emulates the `'backupskip'` option's functionality for the +|+persistent_undo| feature, checking buffer file paths against a list of +globs, and switching the `'undofile'` option off locally if any of them match. + +REQUIREMENTS *undofileskip-requirements* + +This plugin only loads if 'compatible' is not set. If requires both the +|+persistent_undo| feature and the |glob2regpat()| function. The earliest +full release of Vim with both of these was v8.0. + +OPTIONS *undofileskip-options* + + *g:undofileskip* +Set `g:undofileskip` to a list of globs to match against file buffer paths and +switch 'undofile' on or off accordingly. Defaults to the same values as +'backupskip' (or tries to). + +Some possibly useful values: +> + let g:undofileskip = [ + \ '/tmp/*', + \ '/dev/shm/*', + \ '/usr/tmp/*', + \ '/var/tmp/*', + \ '*.git/*_EDITMSG', + \ '*.git/ADD_EDIT.patch', + \ '*.git/rebase-merge/git-rebase-todo', + \] +< +AUTHOR *undofileskip-author* + +Written and maintained by Tom Ryder . + +LICENSE *undofileskip-license* + +Licensed for distribution under the same terms as Vim itself (see |license|). + + vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/undoskip.txt b/doc/undoskip.txt deleted file mode 100644 index c0dbbe5..0000000 --- a/doc/undoskip.txt +++ /dev/null @@ -1,42 +0,0 @@ -*undoskip.txt* For Vim version 8.0 Last change: 2020 May 5 - -DESCRIPTION *undoskip* - -This plugin emulates the `'backupskip'` option's functionality for the -|+persistent_undo| feature, checking buffer file paths against a list of -globs, and switching the `'undofile'` option off locally if any of them match. - -REQUIREMENTS *undoskip-requirements* - -This plugin only loads if 'compatible' is not set. If requires both the -|+persistent_undo| feature and the |glob2regpat()| function. The earliest -full release of Vim with both of these was v8.0. - -OPTIONS *undoskip-options* - - *g:undoskip* -Set `g:undoskip` to a list of globs to match against file buffer paths and -switch 'undofile' on or off accordingly. Defaults to the same values as -'backupskip' (or tries to). - -Some possibly useful values: -> - let g:undoskip = [ - \ '/tmp/*', - \ '/dev/shm/*', - \ '/usr/tmp/*', - \ '/var/tmp/*', - \ '*.git/*_EDITMSG', - \ '*.git/ADD_EDIT.patch', - \ '*.git/rebase-merge/git-rebase-todo', - \] -< -AUTHOR *undoskip-author* - -Written and maintained by Tom Ryder . - -LICENSE *undoskip-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - - vim:tw=78:ts=8:ft=help:norl: diff --git a/plugin/undofileskip.vim b/plugin/undofileskip.vim new file mode 100644 index 0000000..c6b3b1e --- /dev/null +++ b/plugin/undofileskip.vim @@ -0,0 +1,35 @@ +" +" undofileskip.vim: Don't save undo history for temporary or secure files. +" +" Author: Tom Ryder +" License: Same as Vim itself +" +if exists('loaded_undofileskip') || &compatible + finish +endif +if !has('persistent_undo') || !exists('*glob2regpat') + finish +endif +let loaded_undofileskip = 1 + +" Set default list of patterns to exclude; mirror documented 'backupskip' +" behavior +if !exists('g:undofileskip') + let g:undofileskip = [] + if has('mac') + call add(g:undofileskip, '/private/tmp/*') + elseif has('unix') + call add(g:undofileskip, '/tmp/*') + endif + call extend(g:undofileskip, map( + \ filter([$TMPDIR, $TMP, $TEMP], 'v:val !=# '''''), + \ 'v:val.''/*''' + \)) +endif + +" Check the path on every buffer rename, create, or read +augroup undofileskip + autocmd! + autocmd BufAdd,BufNewFile,BufRead * + \ let &l:undofile = undofileskip#Check(expand('')) +augroup END diff --git a/plugin/undoskip.vim b/plugin/undoskip.vim deleted file mode 100644 index 047d9e1..0000000 --- a/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 1996da345dee240a17998b6990030b6abc8d5bfd Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 May 2020 21:29:52 +1200 Subject: Bump VERSION --- VERSION | 2 +- doc/undofileskip.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 17e51c3..0ea3a94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.1 +0.2.0 diff --git a/doc/undofileskip.txt b/doc/undofileskip.txt index dcad260..f0d612e 100644 --- a/doc/undofileskip.txt +++ b/doc/undofileskip.txt @@ -1,4 +1,4 @@ -*undofileskip.txt* For Vim version 8.0 Last change: 2020 May 5 +*undofileskip.txt* For Vim version 8.0 Last change: 2020 May 6 DESCRIPTION *undofileskip* -- cgit v1.2.3