{ config, lib, ... }: let inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim defaultAttributes; 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.startPlugins = ["trouble"]; vim.maps.normal = mkMerge [ (mkSetBinding mappings.toggle "TroubleToggle") (mkSetBinding mappings.workspaceDiagnostics "TroubleToggle workspace_diagnostics") (mkSetBinding mappings.documentDiagnostics "TroubleToggle document_diagnostics") (mkSetBinding mappings.lspReferences "TroubleToggle lsp_references") (mkSetBinding mappings.quickfix "TroubleToggle quickfix") (mkSetBinding mappings.locList "TroubleToggle loclist") ]; vim.binds.whichKey.register = defaultAttributes { "l" = "Trouble"; "x" = "+Trouble"; "lw" = "Workspace"; }; vim.luaConfigRC.trouble = nvim.dag.entryAnywhere '' -- Enable trouble diagnostics viewer require("trouble").setup {} ''; }; }