Skip to content

Commit

Permalink
feat(nvim): add <leader>kd binding to kill (toggle) diagnostics
Browse files Browse the repository at this point in the history
Because sometimes a work-in-progress edit is so broken that Neovim
lights up like a Christmas tree, and (as Tim Robinson might say):

> You can't see shit! You can't see fucken shit!
  • Loading branch information
wincent committed Apr 18, 2024
1 parent 7afcb57 commit bdac8da
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aspects/nvim/files/.config/nvim/lua/wincent/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ local lsp = {}

local on_attach = function()
vim.keymap.set('n', '<Leader>ld', '<cmd>lua vim.diagnostic.open_float()<CR>', { buffer = true, silent = true })

-- Mnemonic: kd = "kill diagnostics" (although it's really "toggle diagnostics")
vim.keymap.set('n', '<Leader>kd', function()
local toggle = not vim.diagnostic.config().virtual_text
vim.diagnostic.config({ virtual_text = toggle })
end, { buffer = true, silent = true })

vim.keymap.set('n', '<c-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', { buffer = true, silent = true })
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', { buffer = true, silent = true })
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.declaration()<CR>', { buffer = true, silent = true })
Expand Down

0 comments on commit bdac8da

Please sign in to comment.