Skip to content

Commit 1fe43f3

Browse files
committed
fix(ui): focus Lazy window when auto-installing plugins in VimEnter
1 parent d4aee27 commit 1fe43f3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lua/lazy/view/init.lua

+11-1
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,19 @@ function M.show(mode)
6565
opts.col = (vim.o.columns - opts.width) / 2
6666
local win = vim.api.nvim_open_win(buf, true, opts)
6767
M._win = win
68-
6968
vim.api.nvim_set_current_win(win)
7069

70+
-- it seems that setting the current win doesn't work before VimEnter,
71+
-- so do that then
72+
if vim.v.vim_did_enter ~= 1 then
73+
vim.api.nvim_create_autocmd("VimEnter", {
74+
once = true,
75+
callback = function()
76+
vim.api.nvim_set_current_win(win)
77+
end,
78+
})
79+
end
80+
7181
vim.bo[buf].buftype = "nofile"
7282
vim.bo[buf].bufhidden = "wipe"
7383
vim.wo[win].conceallevel = 3

0 commit comments

Comments
 (0)