diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-05-19 18:53:04 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-05-19 18:53:04 +0200 |
| commit | 601bdd23a87c71dac8e4c59474c5915db676190f (patch) | |
| tree | 3388d02f1f9096a4d366699f4ac493197adc2583 | |
| parent | 4ca093d7669fca2c59184e32b60a96bfac0090e6 (diff) | |
| download | dotfiles-601bdd23a87c71dac8e4c59474c5915db676190f.tar.gz dotfiles-601bdd23a87c71dac8e4c59474c5915db676190f.zip | |
fix(nvim): correct popup rendering for bullets and LSP docs
RenderMarkdownBullet now uses fg only (no bg) so list bullets adopt the
window background instead of painting Normal's bg as a mismatched box in
popups. open_floating_preview is wrapped to widen hover/signature docs to
the 120-col line-length convention so long signatures wrap less.
| -rw-r--r-- | .config/nvim/plugin/40-colors.lua | 7 | ||||
| -rw-r--r-- | .config/nvim/plugin/50-lsp.lua | 18 |
2 files changed, 25 insertions, 0 deletions
diff --git a/.config/nvim/plugin/40-colors.lua b/.config/nvim/plugin/40-colors.lua index 21c93e7..6e3e59d 100644 --- a/.config/nvim/plugin/40-colors.lua +++ b/.config/nvim/plugin/40-colors.lua @@ -58,10 +58,17 @@ local function adjust_highlight() vim.api.nvim_set_hl(0, "TabLineSel", { bg = "#edffd5" }) vim.api.nvim_set_hl(0, "Cursorline", { bg = "#edffd5" }) vim.api.nvim_set_hl(0, "NormalFloat", { bg = solarized_colors.base2 }) + -- render-markdown links Bullet -> Normal (an explicit bg). The custom + -- NormalFloat bg above then differs from that, so bullets show a + -- mismatched box in popups. Give the glyph Normal's fg but NO bg so it + -- stays transparent and adopts whatever window backs it (Normal in + -- buffers, NormalFloat in popups). + vim.api.nvim_set_hl(0, "RenderMarkdownBullet", { fg = solarized_colors.base00 }) elseif vim.o.background == "dark" then vim.api.nvim_set_hl(0, "TabLineSel", { bg = "#043624" }) vim.api.nvim_set_hl(0, "Cursorline", { bg = "#043624" }) vim.api.nvim_set_hl(0, "NormalFloat", { bg = solarized_colors.base02 }) + vim.api.nvim_set_hl(0, "RenderMarkdownBullet", { fg = solarized_colors.base0 }) end end end diff --git a/.config/nvim/plugin/50-lsp.lua b/.config/nvim/plugin/50-lsp.lua index 938cc64..7f62dae 100644 --- a/.config/nvim/plugin/50-lsp.lua +++ b/.config/nvim/plugin/50-lsp.lua @@ -15,6 +15,24 @@ vim.pack.add({ "https://github.com/neovim/nvim-lspconfig" }) vim.api.nvim_create_user_command("LspInspect", inspect_lsp, { desc = "Inspect LSP client" }) +-- Widen hover / signature-help popups so long signatures don't wrap as much. +-- Both go through the single built-in `vim.lsp.util.open_floating_preview`, +-- so we wrap that one function instead of every call site: +-- 1. Save the original into a local (the only remaining reference to it). +-- 2. Overwrite the table field with our function; Neovim resolves the call +-- through that field, so it now reaches ours transparently. +-- 3. Inject `max_width` only when the caller didn't set one (the 120-col +-- Lua/Markdown line-length convention), then forward every argument +-- unchanged to the original and return its results. +-- The float is still clamped to the available screen space, so a signature +-- longer than the popup can fit will still wrap (just less often). +local open_floating_preview = vim.lsp.util.open_floating_preview +function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) + opts = opts or {} + opts.max_width = opts.max_width or 120 + return open_floating_preview(contents, syntax, opts, ...) +end + -- Enable LSP server capabilities if available when attaching, see `:help lsp-attach` vim.api.nvim_create_autocmd("LspAttach", { desc = "Enable LSP capabilities", |
