Make trouble default to using `document_diagnostics` Also adds keybinds TODO: Add checking to ensure that wk is available before loading it.
65 lines
1.1 KiB
Lua
65 lines
1.1 KiB
Lua
local ok, trouble = pcall(require,'trouble')
|
|
|
|
if not ok then
|
|
return
|
|
end
|
|
|
|
trouble.setup({
|
|
mode = "document_diagnostics",
|
|
auto_open = true,
|
|
auto_close = true,
|
|
|
|
fold_open = "",
|
|
fold_close = "",
|
|
|
|
signs = {
|
|
error = "",
|
|
warning = "",
|
|
hint = "",
|
|
information = "",
|
|
other = "",
|
|
}
|
|
})
|
|
|
|
local map = vim.keymap.set
|
|
|
|
map('n',
|
|
'<leader>xx',
|
|
function()
|
|
trouble.toggle()
|
|
end,
|
|
{desc = "Toggle trouble"})
|
|
map('n',
|
|
'<leader>xw',
|
|
function()
|
|
trouble.toggle('workspace_diagnostics')
|
|
end,
|
|
{desc = "Toggle trouble (workspace)"})
|
|
map('n',
|
|
'<leader>xd',
|
|
function()
|
|
trouble.toggle('document_diagnostics')
|
|
end,
|
|
{desc = "Toggle trouble (document)"})
|
|
map('n',
|
|
'<leader>xq',
|
|
function()
|
|
trouble.toggle('quickfix')
|
|
end,
|
|
{desc = "Toggle trouble (quickfix)"})
|
|
map('n',
|
|
'<leader>xl',
|
|
function()
|
|
trouble.toggle('loclist')
|
|
end,
|
|
{desc = "Toggle trouble (loclist)"})
|
|
map('n',
|
|
'<leader>xt',
|
|
function()
|
|
trouble.toggle('todo')
|
|
end,
|
|
{desc = "Toggle trouble (todo)"})
|
|
|
|
local wk = require("which-key")
|
|
wk.register({ x = {name = "Trouble"}},{prefix = "<leader>"})
|