From 5a0286c68b80c1947b54c0e6cb247b7dfe324906 Mon Sep 17 00:00:00 2001 From: tiyn Date: Tue, 24 Mar 2026 10:36:55 +0100 Subject: [PATCH] NVIM: Improved hover and preview handeling --- .config/nvim/lua/keymap.lua | 2 +- .config/nvim/lua/plugins/goto-preview.lua | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/keymap.lua b/.config/nvim/lua/keymap.lua index fe4ad93..1c35f75 100644 --- a/.config/nvim/lua/keymap.lua +++ b/.config/nvim/lua/keymap.lua @@ -433,7 +433,7 @@ wk.add({ vim.keymap.set("n", "K", function() local winid = require("ufo").peekFoldedLinesUnderCursor() if not winid then - vim.lsp.buf.hover({ border = "rounded" }) + vim.lsp.buf.hover({ border = "rounded", focusable = false, max_width = 100 }) end end, { buffer = bufnr, diff --git a/.config/nvim/lua/plugins/goto-preview.lua b/.config/nvim/lua/plugins/goto-preview.lua index 5ebd2bf..a0bb8a0 100644 --- a/.config/nvim/lua/plugins/goto-preview.lua +++ b/.config/nvim/lua/plugins/goto-preview.lua @@ -6,6 +6,15 @@ return { require("goto-preview").setup({ border = "rounded", preview_window_title = { enable = true, position = "center" }, + + post_open_hook = function(bufnr, winid) + local close = function() + require("goto-preview").close_all_win() + end + + vim.keymap.set("n", "", close, { buffer = bufnr, silent = true }) + vim.keymap.set("n", "q", close, { buffer = bufnr, silent = true }) + end, }) end, }