feat!(trouble): Configure trouble
Make trouble default to using `document_diagnostics` Also adds keybinds TODO: Add checking to ensure that wk is available before loading it.
This commit is contained in:
parent
f59039751a
commit
990b883e87
64
after/plugin/trouble.lua
Normal file
64
after/plugin/trouble.lua
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
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>"})
|
||||||
Loading…
Reference in New Issue
Block a user