Refactor trouble, also disable all highlight changes in trouble for the
time being, it's simply not working very well.
This commit is contained in:
parent
26355c8a5c
commit
1d2e173db6
2 changed files with 98 additions and 41 deletions
|
|
@ -67,8 +67,11 @@ return {
|
||||||
TelescopePreviewNormal = { link = "EdgeTool" },
|
TelescopePreviewNormal = { link = "EdgeTool" },
|
||||||
TelescopePreviewBorder = { link = "EdgeToolBorder" },
|
TelescopePreviewBorder = { link = "EdgeToolBorder" },
|
||||||
|
|
||||||
-- Trouble
|
-- -- Trouble
|
||||||
TroubleNormal = { link = "EdgeTool" },
|
-- TroubleNormal = { bg = colors.red },
|
||||||
|
-- TroubleCount = { bg = colors.red },
|
||||||
|
-- TroubleCode = { bg = colors.red },
|
||||||
|
-- TroubleText = { bg = colors.red },
|
||||||
|
|
||||||
-- Saga
|
-- Saga
|
||||||
SagaNormal = { link = "EdgeTool" },
|
SagaNormal = { link = "EdgeTool" },
|
||||||
|
|
|
||||||
|
|
@ -23,52 +23,106 @@ local function setup_autosize_callback()
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function change_trouble_highlight_background(color_palette)
|
||||||
|
local highlights = {
|
||||||
|
-- "TroubleCode",
|
||||||
|
-- "TroubleCount",
|
||||||
|
-- "TroubleDirectory",
|
||||||
|
-- "TroubleFilename",
|
||||||
|
-- "TroubleIconArray",
|
||||||
|
-- "TroubleIconBoolean",
|
||||||
|
-- "TroubleIconClass",
|
||||||
|
-- "TroubleIconConstant",
|
||||||
|
-- "TroubleIconConstructor",
|
||||||
|
-- "TroubleIconDirectory",
|
||||||
|
-- "TroubleIconEnum",
|
||||||
|
-- "TroubleIconEnumMember",
|
||||||
|
-- "TroubleIconEvent",
|
||||||
|
-- "TroubleIconField",
|
||||||
|
-- "TroubleIconFile",
|
||||||
|
-- "TroubleIconFunction",
|
||||||
|
-- "TroubleIconInterface",
|
||||||
|
-- "TroubleIconKey",
|
||||||
|
-- "TroubleIconMethod",
|
||||||
|
-- "TroubleIconModule",
|
||||||
|
-- "TroubleIconNamespace",
|
||||||
|
-- "TroubleIconNull",
|
||||||
|
-- "TroubleIconNumber",
|
||||||
|
-- "TroubleIconObject",
|
||||||
|
-- "TroubleIconOperator",
|
||||||
|
-- "TroubleIconPackage",
|
||||||
|
-- "TroubleIconProperty",
|
||||||
|
-- "TroubleIconString",
|
||||||
|
-- "TroubleIconStruct",
|
||||||
|
-- "TroubleIconTypeParameter",
|
||||||
|
-- "TroubleIconVariable",
|
||||||
|
-- "TroubleIndent",
|
||||||
|
-- "TroubleIndentFoldClosed",
|
||||||
|
-- "TroubleIndentFoldOpen",
|
||||||
|
-- "TroubleIndentLast",
|
||||||
|
-- "TroubleIndentMiddle",
|
||||||
|
-- "TroubleIndentTop",
|
||||||
|
-- "TroubleIndentWs",
|
||||||
|
-- "TroubleNormal",
|
||||||
|
-- "TroubleNormalNC",
|
||||||
|
-- "TroublePos",
|
||||||
|
-- "TroublePreview",
|
||||||
|
-- "TroubleSource",
|
||||||
|
-- "TroubleText",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, highlight in ipairs(highlights) do
|
||||||
|
local current_highlight = vim.api.nvim_get_hl(0, { name = highlight })
|
||||||
|
current_highlight.bg = "#1e2030" -- color_palette.mantle
|
||||||
|
vim.api.nvim_set_hl(0, highlight, current_highlight)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"folke/trouble.nvim",
|
"folke/trouble.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
local trouble = require("trouble")
|
local trouble = require("trouble")
|
||||||
trouble.setup({})
|
trouble.setup({})
|
||||||
|
|
||||||
|
local utils = require("utils")
|
||||||
|
change_trouble_highlight_background()
|
||||||
setup_autosize_callback()
|
setup_autosize_callback()
|
||||||
require("utils").add_keymaps({
|
|
||||||
n = {
|
local function toggle_trouble_mode(mode_to_toggle)
|
||||||
["<leader>x"] = {
|
is_trouble_window = true
|
||||||
cmd = function()
|
trouble.toggle({
|
||||||
is_trouble_window = true
|
mode = mode_to_toggle,
|
||||||
trouble.toggle({
|
focus = true,
|
||||||
mode = "diagnostics",
|
})
|
||||||
focus = true,
|
end
|
||||||
})
|
|
||||||
end
|
local commands = {
|
||||||
},
|
{
|
||||||
["<leader>ls"] = {
|
keys = "x",
|
||||||
cmd = function()
|
mode = "diagnostics"
|
||||||
is_trouble_window = true
|
},
|
||||||
trouble.toggle({
|
{
|
||||||
mode = "symbols",
|
keys = "ls",
|
||||||
focus = true,
|
mode = "symbols"
|
||||||
})
|
},
|
||||||
end
|
{
|
||||||
},
|
keys = "ll",
|
||||||
["<leader>ll"] = {
|
mode = "loclist"
|
||||||
cmd = function()
|
},
|
||||||
is_trouble_window = true
|
{
|
||||||
trouble.toggle({
|
keys = "lq",
|
||||||
mode = "loclist",
|
mode = "quickfix"
|
||||||
focus = true,
|
},
|
||||||
})
|
}
|
||||||
end
|
|
||||||
},
|
local keymaps = { n = {} }
|
||||||
["<leader>lq"] = {
|
for _, command in ipairs(commands) do
|
||||||
cmd = function()
|
keymaps.n["<leader>" .. command.keys] = {
|
||||||
is_trouble_window = true
|
cmd = function()
|
||||||
trouble.toggle({
|
toggle_trouble_mode(command.mode)
|
||||||
mode = "quickfix",
|
end
|
||||||
focus = true,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
})
|
end
|
||||||
|
utils.add_keymaps(keymaps)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue