nvf/modules/plugins/lsp/trouble/config.nix

41 lines
1.3 KiB
Nix
Raw Normal View History

{
config,
lib,
2024-10-28 02:04:53 +00:00
options,
...
}: let
2024-09-30 19:58:48 +00:00
inherit (lib.modules) mkIf;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding pushDownDefault;
cfg = config.vim.lsp;
2023-05-02 21:28:40 +00:00
2024-10-28 02:04:53 +00:00
mappingDefinitions = options.vim.lsp.trouble.mappings;
2023-05-02 21:28:40 +00:00
mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable && cfg.trouble.enable) {
vim = {
2024-10-17 15:17:18 +00:00
lazy.plugins.trouble = {
package = "trouble";
setupModule = "trouble";
inherit (cfg.trouble) setupOpts;
2024-10-17 15:17:18 +00:00
cmd = "Trouble";
keys = [
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>")
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
];
};
binds.whichKey.register = pushDownDefault {
"<leader>l" = "Trouble";
"<leader>x" = "+Trouble";
"<leader>lw" = "Workspace";
};
};
};
}