fix(ui): focus Lazy window when auto-installing plugins in `VimEnter`

This commit is contained in:
Folke Lemaitre 2022-12-19 12:20:02 +01:00
parent d4aee2715f
commit 1fe43f3e29
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 11 additions and 1 deletions

View File

@ -65,9 +65,19 @@ function M.show(mode)
opts.col = (vim.o.columns - opts.width) / 2
local win = vim.api.nvim_open_win(buf, true, opts)
M._win = win
vim.api.nvim_set_current_win(win)
-- it seems that setting the current win doesn't work before VimEnter,
-- so do that then
if vim.v.vim_did_enter ~= 1 then
vim.api.nvim_create_autocmd("VimEnter", {
once = true,
callback = function()
vim.api.nvim_set_current_win(win)
end,
})
end
vim.bo[buf].buftype = "nofile"
vim.bo[buf].bufhidden = "wipe"
vim.wo[win].conceallevel = 3