{ config, lib, ... }: let inherit (lib.modules) mkIf; inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding pushDownDefault; cfg = config.vim.lsp; self = import ./trouble.nix {inherit lib;}; mappingDefinitions = self.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.toggle "TroubleToggle") (mkSetLznBinding mappings.workspaceDiagnostics "TroubleToggle workspace_diagnostics") (mkSetLznBinding mappings.documentDiagnostics "TroubleToggle document_diagnostics") (mkSetLznBinding mappings.lspReferences "TroubleToggle lsp_references") (mkSetLznBinding mappings.quickfix "TroubleToggle quickfix") (mkSetLznBinding mappings.locList "TroubleToggle loclist") ]; }; binds.whichKey.register = pushDownDefault { "l" = "Trouble"; "x" = "+Trouble"; "lw" = "Workspace"; }; }; }; }