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,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding pushDownDefault;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding pushDownDefault;
|
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
|
|
||||||
|
@ -15,15 +14,22 @@
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["trouble"];
|
lazy.plugins = [
|
||||||
|
{
|
||||||
|
package = "trouble";
|
||||||
|
setupModule = "trouble";
|
||||||
|
inherit (cfg.trouble) setupOpts;
|
||||||
|
|
||||||
maps.normal = mkMerge [
|
cmd = "Trouble";
|
||||||
(mkSetBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
keys = [
|
||||||
(mkSetBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
||||||
(mkSetBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
||||||
(mkSetBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
||||||
(mkSetBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
||||||
(mkSetBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
||||||
|
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
||||||
|
];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
|
@ -31,11 +37,6 @@ in {
|
||||||
"<leader>x" = "+Trouble";
|
"<leader>x" = "+Trouble";
|
||||||
"<leader>lw" = "Workspace";
|
"<leader>lw" = "Workspace";
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginRC.trouble = entryAnywhere ''
|
|
||||||
-- Enable trouble diagnostics viewer
|
|
||||||
require("trouble").setup {}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.lsp = {
|
options.vim.lsp = {
|
||||||
trouble = {
|
trouble = {
|
||||||
enable = mkEnableOption "trouble diagnostics viewer";
|
enable = mkEnableOption "trouble diagnostics viewer";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "Trouble" {};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
toggle = mkMappingOption "Toggle trouble [trouble]" "<leader>xx";
|
toggle = mkMappingOption "Toggle trouble [trouble]" "<leader>xx";
|
||||||
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
||||||
|
|
Loading…
Reference in a new issue