2023-02-01 20:11:37 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
2024-11-04 16:50:50 +01:00
|
|
|
options,
|
2023-02-01 20:11:37 +01:00
|
|
|
...
|
2023-11-08 03:16:46 +01:00
|
|
|
}: let
|
2024-11-04 16:50:50 +01:00
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding pushDownDefault;
|
2023-11-08 03:16:46 +01:00
|
|
|
|
2023-02-01 20:11:37 +01:00
|
|
|
cfg = config.vim.lsp;
|
2023-05-02 23:28:40 +02:00
|
|
|
|
2024-11-04 16:50:50 +01:00
|
|
|
mappingDefinitions = options.vim.lsp.trouble.mappings;
|
2023-05-02 23:28:40 +02:00
|
|
|
mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions;
|
2023-02-01 20:11:37 +01:00
|
|
|
in {
|
|
|
|
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
2024-03-12 01:46:29 +01:00
|
|
|
vim = {
|
2024-11-04 16:50:50 +01:00
|
|
|
lazy.plugins.trouble = {
|
|
|
|
package = "trouble";
|
|
|
|
setupModule = "trouble";
|
|
|
|
inherit (cfg.trouble) setupOpts;
|
2023-02-01 20:11:37 +01:00
|
|
|
|
2024-11-04 16:50:50 +01:00
|
|
|
cmd = "Trouble";
|
|
|
|
keys = [
|
2024-11-10 19:52:12 +01:00
|
|
|
(mkSetLznBinding "n" mappings.workspaceDiagnostics "<cmd>Trouble toggle diagnostics<CR>")
|
|
|
|
(mkSetLznBinding "n" mappings.documentDiagnostics "<cmd>Trouble toggle diagnostics filter.buf=0<CR>")
|
|
|
|
(mkSetLznBinding "n" mappings.lspReferences "<cmd>Trouble toggle lsp_references<CR>")
|
|
|
|
(mkSetLznBinding "n" mappings.quickfix "<cmd>Trouble toggle quickfix<CR>")
|
|
|
|
(mkSetLznBinding "n" mappings.locList "<cmd>Trouble toggle loclist<CR>")
|
|
|
|
(mkSetLznBinding "n" mappings.symbols "<cmd>Trouble toggle symbols<CR>")
|
2024-11-04 16:50:50 +01:00
|
|
|
];
|
|
|
|
};
|
2023-02-01 20:11:37 +01:00
|
|
|
|
2024-03-12 01:46:29 +01:00
|
|
|
binds.whichKey.register = pushDownDefault {
|
|
|
|
"<leader>x" = "+Trouble";
|
2024-11-10 19:52:12 +01:00
|
|
|
"<leader>lw" = "+Workspace";
|
2024-03-12 01:46:29 +01:00
|
|
|
};
|
|
|
|
};
|
2023-02-01 20:11:37 +01:00
|
|
|
};
|
|
|
|
}
|