mirror of https://github.com/folke/lazy.nvim.git
fix(ui): open with noautocmd=true and close with vim.schedule to prevent weird errors by other plugins
This commit is contained in:
parent
836cdb2bea
commit
08d081f21d
|
@ -57,6 +57,7 @@ function M.show(mode)
|
||||||
border = Config.options.ui.border,
|
border = Config.options.ui.border,
|
||||||
width = math.min(vim.o.columns - hpad * 2, 200),
|
width = math.min(vim.o.columns - hpad * 2, 200),
|
||||||
height = math.min(vim.o.lines - vpad * 2, 70),
|
height = math.min(vim.o.lines - vpad * 2, 70),
|
||||||
|
noautocmd = true,
|
||||||
}
|
}
|
||||||
opts.row = (vim.o.lines - opts.height) / 2
|
opts.row = (vim.o.lines - opts.height) / 2
|
||||||
opts.col = (vim.o.columns - opts.width) / 2
|
opts.col = (vim.o.columns - opts.width) / 2
|
||||||
|
@ -75,16 +76,14 @@ function M.show(mode)
|
||||||
local function close()
|
local function close()
|
||||||
M._buf = nil
|
M._buf = nil
|
||||||
vim.diagnostic.reset(Config.ns, buf)
|
vim.diagnostic.reset(Config.ns, buf)
|
||||||
|
vim.schedule(function()
|
||||||
if vim.api.nvim_buf_is_valid(buf) then
|
if vim.api.nvim_buf_is_valid(buf) then
|
||||||
vim.api.nvim_buf_delete(buf, {
|
vim.api.nvim_buf_delete(buf, { force = true })
|
||||||
force = true,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.api.nvim_win_is_valid(win) then
|
if vim.api.nvim_win_is_valid(win) then
|
||||||
vim.api.nvim_win_close(win, true)
|
vim.api.nvim_win_close(win, true)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set("n", "q", close, {
|
vim.keymap.set("n", "q", close, {
|
||||||
|
|
Loading…
Reference in New Issue