refactor(nvim): ensure passage
files aren't backed up
This commit is contained in:
parent
d3528370bd
commit
c8a2092475
@ -141,7 +141,8 @@ M.setup = function()
|
||||
opt.exrc = true
|
||||
|
||||
-- Backups
|
||||
opt.backupdir = vim.fn.stdpath('state') .. "/backup//"
|
||||
opt.backupdir = vim.fn.stdpath("state") .. "/backup//"
|
||||
opt.backupskip = opt.backupskip + "*/*passage.*"
|
||||
opt.backup = true
|
||||
end
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
local M = {}
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("user-autocmds", { clear = false })
|
||||
vim.api.nvim_create_autocmd("BufReadPre", {
|
||||
group = augroup,
|
||||
desc = "Ensure backupskip files do not leave anything behind",
|
||||
pattern = vim.opt.backupskip:get(),
|
||||
callback = function(args)
|
||||
---@type integer
|
||||
local bufnr = args.buf
|
||||
|
||||
vim.iter({
|
||||
"swapfile",
|
||||
"undofile",
|
||||
}):each(function(opt)
|
||||
vim.api.nvim_set_option_value(opt, false, {
|
||||
buf = bufnr,
|
||||
})
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
return M
|
Loading…
Reference in New Issue
Block a user