mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-08 08:05:58 +01:00
trouble: lazy load
This commit is contained in:
parent
0608e107cd
commit
6c92f6cec5
2 changed files with 20 additions and 16 deletions
|
@ -3,9 +3,8 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding pushDownDefault;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding pushDownDefault;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
|
||||
|
@ -15,15 +14,22 @@
|
|||
in {
|
||||
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
||||
vim = {
|
||||
startPlugins = ["trouble"];
|
||||
lazy.plugins = [
|
||||
{
|
||||
package = "trouble";
|
||||
setupModule = "trouble";
|
||||
inherit (cfg.trouble) setupOpts;
|
||||
|
||||
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>")
|
||||
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 {
|
||||
|
@ -31,11 +37,6 @@ in {
|
|||
"<leader>x" = "+Trouble";
|
||||
"<leader>lw" = "Workspace";
|
||||
};
|
||||
|
||||
pluginRC.trouble = entryAnywhere ''
|
||||
-- Enable trouble diagnostics viewer
|
||||
require("trouble").setup {}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.lsp = {
|
||||
trouble = {
|
||||
enable = mkEnableOption "trouble diagnostics viewer";
|
||||
|
||||
setupOpts = mkPluginSetupOption "Trouble" {};
|
||||
|
||||
mappings = {
|
||||
toggle = mkMappingOption "Toggle trouble [trouble]" "<leader>xx";
|
||||
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
||||
|
|
Loading…
Reference in a new issue