aboutsummaryrefslogtreecommitdiff
path: root/autoload/undoskip.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-05 22:06:46 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-05 22:06:46 +1200
commitd0e9d6b498a7a98951e6ad7717ea77d749e30f7c (patch)
treefb576ec38c7f0704700b5a6df28eeb0ed3e2ab33 /autoload/undoskip.vim
downloadvim-undofileskip-d0e9d6b498a7a98951e6ad7717ea77d749e30f7c.tar.gz
vim-undofileskip-d0e9d6b498a7a98951e6ad7717ea77d749e30f7c.zip
First version, spun out from tejr dotfiles v8.29.1v0.1.0
Diffstat (limited to 'autoload/undoskip.vim')
-rw-r--r--autoload/undoskip.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/autoload/undoskip.vim b/autoload/undoskip.vim
new file mode 100644
index 0000000..8813ff1
--- /dev/null
+++ b/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