nvim: Disable history when editing jrnl files

This commit is contained in:
Marty Oehme 2025-03-06 21:16:58 +01:00
parent e36ed17a97
commit 07a619060a
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -5,18 +5,35 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, {
group = vim.api.nvim_create_augroup("highlightyanks", { clear = true }),
})
local private_mode = function()
vim.o.shada = ""
vim.o.swapfile = false
vim.o.undofile = false
vim.o.backup = false
vim.o.writebackup = false
vim.o.shelltemp = false
vim.o.history = 0
vim.o.modeline = false
vim.o.secure = true
end
-- Special setting for editing gopass files - make sure nothing leaks outside the directories it
-- is supposed to
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
group = vim.api.nvim_create_augroup("passnoleak", { clear = true }),
pattern = {
"/dev/shm/gopass.*",
"/dev/shm/pass.?*/?*.txt",
"$TMPDIR/pass.?*/?*.txt",
"/tmp/pass.?*/?*.txt",
},
command = "setlocal noswapfile nobackup noundofile nowritebackup viminfo=",
desc = "Don't leak any information when editing potential password files",
group = vim.api.nvim_create_augroup("passnoleak", { clear = true }),
callback = private_mode,
})
vim.api.nvim_create_autocmd({ "BufNewFile", "BufReadPre" }, {
group = vim.api.nvim_create_augroup("PrivateJrnl", {}),
pattern = "*.jrnl",
desc = "Don't leak information when editing jrnl files",
callback = private_mode,
})
-- remove line numbers from terminal buffers