~whynothugo/dotfiles

38b900dc12ae810eda071e6fd1e4f25db6bb3a2a — Hugo Osvaldo Barrera a month ago 271cb79
nvim: Add borders to hover float windows
2 files changed, 13 insertions(+), 3 deletions(-)

M home/.config/nvim/init.lua
M home/.config/nvim/lua/mappings.lua
M home/.config/nvim/init.lua => home/.config/nvim/init.lua +12 -0
@@ 186,6 186,18 @@ require("gitsigns").setup({
  },
})

-- Show borders for hover floats.
--
-- Neovim shows "hover" information on a DOS style popups. I'd prefer these to
-- be on splits, but that doesn't seem trivial, so at least add borders to make
-- slightly less visually confusing.
--
-- See: https://github.com/jdhao/nvim-config/blob/95b7ee5/lua/config/lsp.lua#L209-L212
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
  border = "rounded",
})
-- TODO: Would be super nice to close floats with <Esc>

-- Language parsing and highlighting ==========================================
-- nvim-treesitter configures tree sitters which, amongst other things, provide
-- highlighting and syntax navigation.

M home/.config/nvim/lua/mappings.lua => home/.config/nvim/lua/mappings.lua +1 -3
@@ 160,10 160,8 @@ vim.keymap.set(
  "n",
  "<Leader>h",
  vim.lsp.buf.hover,
  { remap = true, desc = "Show hover details" }
  { remap = true, desc = "Show hover details. Use twice to focus hover." }
)
-- TODO: focus the hover float after creating it.
-- TODO: Also map <Esc> to closing it. The goal is to be able to easily scroll AND dismiss it.
vim.keymap.set("n", "<Leader>r", function()
  require("trouble").toggle("lsp_references")
end, { desc = "Show LSP references" })