diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-24 21:05:42 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-24 21:14:06 +0200 |
| commit | b0130288e93e00d5f37a5cf70bc8920216600aa7 (patch) | |
| tree | 6a2473e3f7940c2ec17643359fa78f6a07a8faca /plugin | |
| parent | 0ea43875b7dc5c43e372c9bf9b666486c2d56df8 (diff) | |
| download | nvim-config-b0130288e93e00d5f37a5cf70bc8920216600aa7.tar.gz nvim-config-b0130288e93e00d5f37a5cf70bc8920216600aa7.zip | |
misc(nvim): don't show LSP hint by default, add command to toggle
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/50-color.lua | 13 | ||||
| -rw-r--r-- | plugin/50-lsp.lua | 14 |
2 files changed, 13 insertions, 14 deletions
diff --git a/plugin/50-color.lua b/plugin/50-color.lua index c525866..5eb03b3 100644 --- a/plugin/50-color.lua +++ b/plugin/50-color.lua @@ -83,9 +83,12 @@ local function spell_status() end end --- Custom status flags: "+F" when formatting is on for the buffer, followed by the spell flag. +-- Custom status flags: "+F" when formatting is on for the buffer, "+H" when LSP inlay hints are on, +-- followed by the spell flag. local function statuses() - return (vim.b.format and "+F" or "") .. (vim.o.spell and spell_status() or "") + return (vim.b.format and "+F" or "") + .. (vim.lsp.inlay_hint.is_enabled({ bufnr = 0 }) and "+H" or "") + .. (vim.o.spell and spell_status() or "") end -- lualine builds its own section-b-backed highlights for the diff/diagnostics components @@ -101,7 +104,7 @@ local function bold_diff_diag() end local lualine_sections = { - lualine_c = { statuses, "filename" }, + lualine_c = { statuses }, lualine_x = { "encoding", "fileformat", "filetype", "lsp_status" }, } @@ -112,7 +115,7 @@ local lualine_options = { } -- Pick the lualine theme from 'background' and (re)apply the configuration. -local function setup() +local function configure_lualine() lualine_options.theme = vim.o.background == "light" and "solarized_light" or "solarized_dark" lualine.setup({ options = lualine_options, sections = lualine_sections }) end @@ -120,7 +123,7 @@ end -- Statusline applier: re-pick the lualine theme for the current 'background', then re-bold the -- diff/diagnostics groups once lualine has rebuilt them. local function apply_statusline_highlights() - setup() + configure_lualine() vim.schedule(bold_diff_diag) end diff --git a/plugin/50-lsp.lua b/plugin/50-lsp.lua index 8b0c74b..1294378 100644 --- a/plugin/50-lsp.lua +++ b/plugin/50-lsp.lua @@ -2,11 +2,12 @@ -- 50-lsp.lua -- -- * Configures and enables the LSP servers (lua_ls, bashls, marksman, vimls, basedpyright, ruff). --- * On attach, enables completion and inlay hints for clients that support them. +-- * On attach, enables completion for clients that support it. Inlay hints default off; toggle them +-- with `LspHintToggle`. -- -- User commands: -- `LspInspect`: inspect the first LSP client's server capabilities --- `LspHintToggle`: toggle LSP inlay hints in the current buffer +-- `LspHintToggle`: toggle LSP inlay hints globally -- -- Notify the first attached LSP client's server capabilities. @@ -27,16 +28,11 @@ local function on_lsp_attach(ev) else vim.notify("Client " .. client.name .. " does not support completion", vim.log.levels.WARN) end - if client:supports_method("textDocument/inlayHint") then - vim.lsp.inlay_hint.enable(true, { bufnr = 0 }) - else - vim.notify("Client " .. client.name .. " does not support inlay hints", vim.log.levels.WARN) - end end --- Toggle LSP inlay hints in the current buffer. +-- Toggle LSP inlay hints globally, across all buffers. local function toggle_lsp_hints() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = 0 }), { bufnr = 0 }) + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end ---------------------------------------------------------------------------------------------------- |
