Closed roeybenarieh closed 2 weeks ago
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
The problem still exists.
It IS being executed, however session loading is done inside silent!
, so your print statement will be silenced.
Check with:
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"folke/persistence.nvim",
lazy = false,
opts = {},
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
local msg = {}
-- create an autocmd to print when BufReadPost is triggered
vim.api.nvim_create_autocmd("BufRead", {
callback = function(ev)
local name = vim.api.nvim_buf_get_name(ev.buf)
msg[#msg + 1] = "BufRead triggered for " .. name
end,
})
vim.cmd.colorscheme("tokyonight")
vim.o.cmdheight = 5
vim.defer_fn(function()
require("persistence").load()
vim.schedule(function()
vim.print(msg)
end)
end, 100)
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.9.4
Operating system/version
Ubuntu 22.04.4 LTS
Describe the bug
When I enter Neovim and load a session, I can see a file that has been loaded, but the BufReadPost/BufRead event hasn't been triggered. This is a very annoying bug, I can't make any autocmd with this event just because of this.
Steps To Reproduce
Expected Behavior
Every time a session is loaded and a buffer is shown, the BufReadPost/BufRead event should occur
Repro