aboutsummaryrefslogtreecommitdiff
path: root/autoload/undofileskip.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-06 21:16:56 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-06 21:16:56 +1200
commit288978a011ce1515431ae58b4759722207a7739c (patch)
tree2dc9d862d955fb81c9f02dfec11a5c773c14bd45 /autoload/undofileskip.vim
parentMerge branch 'hotfix/v0.1.1' into develop (diff)
downloadvim-undofileskip-288978a011ce1515431ae58b4759722207a7739c.tar.gz
vim-undofileskip-288978a011ce1515431ae58b4759722207a7739c.zip
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.
Diffstat (limited to 'autoload/undofileskip.vim')
-rw-r--r--autoload/undofileskip.vim20
1 files changed, 20 insertions, 0 deletions
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