From 7543cc272512b687a9dae45c3c24169bcf7f8f36 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 31 Oct 2024 13:57:13 +0100 Subject: [PATCH] toggleterm: make lazygit keybind optional --- modules/plugins/terminal/toggleterm/config.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/plugins/terminal/toggleterm/config.nix b/modules/plugins/terminal/toggleterm/config.nix index d96e480..68be3de 100644 --- a/modules/plugins/terminal/toggleterm/config.nix +++ b/modules/plugins/terminal/toggleterm/config.nix @@ -5,6 +5,7 @@ }: let inherit (builtins) toJSON; inherit (lib.strings) optionalString; + inherit (lib.lists) optional; inherit (lib.modules) mkIf; inherit (lib.meta) getExe; inherit (lib.nvim.binds) mkLznBinding; @@ -17,13 +18,12 @@ in { lazy.plugins.toggleterm-nvim = { package = "toggleterm-nvim"; cmd = ["ToggleTerm" "ToggleTermSendCurrentLine" "ToggleTermSendVisualLines" "ToggleTermSendVisualSelection" "ToggleTermSetName" "ToggleTermToggleAll"]; - keys = [ - (mkLznBinding ["n"] cfg.mappings.open "execute v:count . \"ToggleTerm\"" "Toggle terminal") - { + keys = + [(mkLznBinding ["n"] cfg.mappings.open "execute v:count . \"ToggleTerm\"" "Toggle terminal")] + ++ optional cfg.lazygit.enable { key = cfg.lazygit.mappings.open; desc = lazygitMapDesc; - } - ]; + }; setupModule = "toggleterm"; inherit (cfg) setupOpts;