Skip to content

Commit 08d081f

Browse files
committed
fix(ui): open with noautocmd=true and close with vim.schedule to prevent weird errors by other plugins
1 parent 836cdb2 commit 08d081f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lua/lazy/view/init.lua

+9-10
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function M.show(mode)
5757
border = Config.options.ui.border,
5858
width = math.min(vim.o.columns - hpad * 2, 200),
5959
height = math.min(vim.o.lines - vpad * 2, 70),
60+
noautocmd = true,
6061
}
6162
opts.row = (vim.o.lines - opts.height) / 2
6263
opts.col = (vim.o.columns - opts.width) / 2
@@ -75,16 +76,14 @@ function M.show(mode)
7576
local function close()
7677
M._buf = nil
7778
vim.diagnostic.reset(Config.ns, buf)
78-
79-
if vim.api.nvim_buf_is_valid(buf) then
80-
vim.api.nvim_buf_delete(buf, {
81-
force = true,
82-
})
83-
end
84-
85-
if vim.api.nvim_win_is_valid(win) then
86-
vim.api.nvim_win_close(win, true)
87-
end
79+
vim.schedule(function()
80+
if vim.api.nvim_buf_is_valid(buf) then
81+
vim.api.nvim_buf_delete(buf, { force = true })
82+
end
83+
if vim.api.nvim_win_is_valid(win) then
84+
vim.api.nvim_win_close(win, true)
85+
end
86+
end)
8887
end
8988

9089
vim.keymap.set("n", "q", close, {

0 commit comments

Comments
 (0)