From 3814883aaae3facc931087bfa7352ca18fa658ac Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 21 Dec 2022 08:33:10 +0100 Subject: [PATCH] fix(ui): set current win only when its valid --- TODO.md | 1 + lua/lazy/view/init.lua | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index da44046..3d795d2 100644 --- a/TODO.md +++ b/TODO.md @@ -60,3 +60,4 @@ - [x] Most emojis in "Configuration" aren't shown for me. - [x] add section on how to uninstall - [x] add `:Packadd` command or something similar +- [ ] headless install diff --git a/lua/lazy/view/init.lua b/lua/lazy/view/init.lua index f93424f..4b601de 100644 --- a/lua/lazy/view/init.lua +++ b/lua/lazy/view/init.lua @@ -81,7 +81,9 @@ function M.show(mode) vim.api.nvim_create_autocmd("VimEnter", { once = true, callback = function() - vim.api.nvim_set_current_win(win) + if win and vim.api.nvim_win_is_valid(win) then + pcall(vim.api.nvim_set_current_win, win) + end end, }) end