Skip to content

Commit

Permalink
fix(ui): focus Lazy window when auto-installing plugins in VimEnter
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 19, 2022
1 parent d4aee27 commit 1fe43f3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lua/lazy/view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1fe43f3

Please sign in to comment.