mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-30 23:00:01 +02:00
fix(keymaps): no diagnostic keymaps w/o lsp attached (#1698)
This commit is contained in:
parent
385c99dbb7
commit
873ff89284
2 changed files with 16 additions and 15 deletions
|
@ -98,6 +98,22 @@ map({ "n", "v" }, "<leader>cf", function()
|
|||
Util.format({ force = true })
|
||||
end, { desc = "Format" })
|
||||
|
||||
-- diagnostic
|
||||
local diagnostic_goto = function(next, severity)
|
||||
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
|
||||
severity = severity and vim.diagnostic.severity[severity] or nil
|
||||
return function()
|
||||
go({ severity = severity })
|
||||
end
|
||||
end
|
||||
map("n", "<leader>cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" })
|
||||
map("n", "]d", diagnostic_goto(true), { desc = "Next Diagnostic" })
|
||||
map("n", "[d", diagnostic_goto(false), { desc = "Prev Diagnostic" })
|
||||
map("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next Error" })
|
||||
map("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Prev Error" })
|
||||
map("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next Warning" })
|
||||
map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" })
|
||||
|
||||
-- stylua: ignore start
|
||||
|
||||
-- toggle options
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue