diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-05 22:16:03 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-05 22:16:03 +1200 |
commit | 3f0b1d25cd5c2f917fa358f0cda00e4c9bc2c40a (patch) | |
tree | 4d29456ed01d72929d7a0f06ebac145f6891d976 | |
parent | Move undoskip.vim function into autoload (diff) | |
download | dotfiles-3f0b1d25cd5c2f917fa358f0cda00e4c9bc2c40a.tar.gz dotfiles-3f0b1d25cd5c2f917fa358f0cda00e4c9bc2c40a.zip |
Spin undoskip.vim out into its own repository
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | vim/autoload/undoskip.vim | 20 | ||||
m--------- | vim/bundle/undoskip | 0 | ||||
-rw-r--r-- | vim/plugin/undoskip.vim | 35 |
4 files changed, 3 insertions, 55 deletions
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 +Subproject d0e9d6b498a7a98951e6ad7717ea77d749e30f7 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 <tom@sanctum.geek.nz> -" 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('<amatch>')) -augroup END |