diff --git a/modules/terminal/toggleterm/config.nix b/modules/terminal/toggleterm/config.nix index 6e049a2..9caf691 100644 --- a/modules/terminal/toggleterm/config.nix +++ b/modules/terminal/toggleterm/config.nix @@ -6,7 +6,6 @@ with lib; with builtins; let cfg = config.vim.terminal.toggleterm; - toggleKey = ""; in { config = mkMerge [ ( @@ -14,7 +13,7 @@ in { vim.startPlugins = [ "toggleterm-nvim" ]; - + vim.maps.normal = mkBinding cfg.mappings.open "execute v:count . \"ToggleTerm\"" "Toggle terminal"; vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere '' @@ -57,11 +56,10 @@ in { hidden = true, on_open = function(term) vim.cmd("startinsert!") - vim.keymap.set( 't', [[${toggleKey}]], function() term:toggle() end, {silent = true, noremap = true, buffer = term.bufnr}) end }) - vim.keymap.set( 'n', [[gg]], function() lazygit:toggle() end, {silent = true, noremap = true}) + vim.keymap.set('n', ${toJSON cfg.lazygit.mappings.open}, function() lazygit:toggle() end, {silent = true, noremap = true, desc = 'Open lazygit [toggleterm]'}) ''; } ) diff --git a/modules/terminal/toggleterm/toggleterm.nix b/modules/terminal/toggleterm/toggleterm.nix index 347d579..35effff 100644 --- a/modules/terminal/toggleterm/toggleterm.nix +++ b/modules/terminal/toggleterm/toggleterm.nix @@ -37,6 +37,10 @@ with builtins; { default = pkgs.lazygit; description = "The package that should be used for lazygit. Setting it to null will attempt to use lazygit from your PATH"; }; + + mappings = { + open = mkMappingOption "Open lazygit [toggleterm]" "gg"; + }; }; }; }