{ config, lib, options, ... }: let inherit (lib.modules) mkIf; inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding pushDownDefault; cfg = config.vim.lsp; mappingDefinitions = options.vim.lsp.trouble.mappings; mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions; in { config = mkIf (cfg.enable && cfg.trouble.enable) { vim = { lazy.plugins.trouble = { package = "trouble"; setupModule = "trouble"; inherit (cfg.trouble) setupOpts; cmd = "Trouble"; keys = [ (mkSetLznBinding mappings.workspaceDiagnostics "Trouble toggle diagnostics") (mkSetLznBinding mappings.documentDiagnostics "Trouble toggle diagnostics filter.buf=0") (mkSetLznBinding mappings.lspReferences "Trouble toggle lsp_references") (mkSetLznBinding mappings.quickfix "Trouble toggle quickfix") (mkSetLznBinding mappings.locList "Trouble toggle loclist") (mkSetLznBinding mappings.symbols "Trouble toggle symbols") ]; }; binds.whichKey.register = pushDownDefault { "x" = "+Trouble"; "lw" = "+Workspace"; }; }; }; }