From df6c46b5fbd5fff89b59601f63ae14604f18e26c Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Tue, 14 Jan 2025 11:47:53 +0100 Subject: [PATCH] Add lspsaga hack for better experience using hover_doc. --- home/.config/nvim/lua/plugs/lspsaga.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/home/.config/nvim/lua/plugs/lspsaga.lua b/home/.config/nvim/lua/plugs/lspsaga.lua index 71b5017..9472b0a 100644 --- a/home/.config/nvim/lua/plugs/lspsaga.lua +++ b/home/.config/nvim/lua/plugs/lspsaga.lua @@ -30,7 +30,16 @@ return { local keymaps = { n = { ["K"] = { - cmd = ":Lspsaga hover_doc" + -- Awful hack to make sure the hover_doc window is closed when pressing q + -- This forces you to jump into the hover_doc window because running the same command when the window is open makes you jump into it, and inside of it q closes the window. + cmd = function() + vim.schedule(function() + vim.cmd("Lspsaga hover_doc") + vim.defer_fn(function() + vim.cmd("Lspsaga hover_doc") + end, 75) + end) + end }, ["rn"] = { cmd = ":Lspsaga rename"