.config/nvim/lua/config/autocmds.lua

changeset 1157
a237720efee9
parent 1129
1bd6edeaf6ae
child 1159
9a19621f294c
--- a/.config/nvim/lua/config/autocmds.lua
+++ b/.config/nvim/lua/config/autocmds.lua
@@ -50,3 +50,11 @@ end)
 autocmd(g, "BufReadPost", "*", function()
   fn.matchadd("Error", [[\m^\([<>|]\)\{7} \@=\|^=\{7}$]])
 end)
+
+-- >> Prune old backup and undo files at startup
+autocmd(g, "User", "VeryLazy", function()
+  local prune_files = require("config.util").prune_files
+  if vim.go.backup then prune_files(vim.go.backupdir, 90) end
+  if vim.go.undofile then prune_files(vim.go.undodir, 90) end
+end)
+

mercurial