nvim: Add mapping to toggle buffer diagnostics
If you want to hide buffer diagnostics for any reason, there is now a quick mapping reachable through the usual lsp submenu: `<localleader>lo` (I suppose the mnemonic would be 'lsp off'). It toggles them enabled and disabled and only affects the current buffer.
This commit is contained in:
parent
5e2239ac10
commit
c3fe4cdc58
1 changed files with 7 additions and 0 deletions
|
@ -109,6 +109,13 @@ local function on_attach(client, bufnr)
|
||||||
"<cmd>lua vim.lsp.buf.signature_help()<cr>",
|
"<cmd>lua vim.lsp.buf.signature_help()<cr>",
|
||||||
{ buffer = bufnr, desc = "Signature help" }
|
{ buffer = bufnr, desc = "Signature help" }
|
||||||
)
|
)
|
||||||
|
map("n", "<localleader>lo", function()
|
||||||
|
if vim.diagnostic.is_disabled(0) then
|
||||||
|
vim.diagnostic.enable(0)
|
||||||
|
else
|
||||||
|
vim.diagnostic.disable(0)
|
||||||
|
end
|
||||||
|
end, { buffer = bufnr, desc = "Disable buffer diagnostics" })
|
||||||
|
|
||||||
if vim.g.format_on_save then
|
if vim.g.format_on_save then
|
||||||
require("lsp-setup.utils").format_on_save(client)
|
require("lsp-setup.utils").format_on_save(client)
|
||||||
|
|
Loading…
Reference in a new issue