mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-02 03:21:14 +00:00
39 lines
1.2 KiB
Nix
39 lines
1.2 KiB
Nix
{
|
|
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 "<cmd>TroubleToggle<CR>")
|
|
(mkSetBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
|
(mkSetBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
|
(mkSetBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
|
(mkSetBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
|
(mkSetBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
|
];
|
|
|
|
vim.binds.whichKey.register = defaultAttributes {
|
|
"<leader>l" = "Trouble";
|
|
"<leader>x" = "+Trouble";
|
|
"<leader>lw" = "Workspace";
|
|
};
|
|
|
|
vim.luaConfigRC.trouble = nvim.dag.entryAnywhere ''
|
|
-- Enable trouble diagnostics viewer
|
|
require("trouble").setup {}
|
|
'';
|
|
};
|
|
}
|