(lazygit) add option `package`

This commit is contained in:
Ching Pei Yang 2023-04-27 12:52:34 +02:00
parent f8ff3cd9fa
commit 2018cd7b2f
2 changed files with 17 additions and 3 deletions

View File

@ -9,7 +9,8 @@ with builtins; let
toggleKey = "<c-t>";
in {
config = mkMerge [
(mkIf cfg.enable {
(
mkIf cfg.enable {
vim.startPlugins = [
"toggleterm-nvim"
];
@ -39,10 +40,17 @@ in {
(
mkIf (cfg.enable && cfg.lazygit.enable)
{
vim.luaConfigRC.toggleterm-lazygit = mkIf cfg.lazygit.enable nvim.dag.entryAfter ["toggleterm"] ''
vim.startPlugins = lib.optionals (cfg.lazygit.package != null) [
cfg.lazygit.package
];
vim.luaConfigRC.toggleterm-lazygit = nvim.dag.entryAfter ["toggleterm"] ''
local terminal = require 'toggleterm.terminal'
local lazygit = terminal.Terminal:new({
cmd = "lazygit",
cmd = '${
if (cfg.lazygit.package != null)
then getExe cfg.lazygit.package
else "lazygit"
}',
direction = '${cfg.lazygit.direction}',
hidden = true,
on_open = function(term)

View File

@ -1,4 +1,5 @@
{
pkgs,
config,
lib,
...
@ -24,6 +25,11 @@ with builtins; {
default = "float";
description = "Direction of the lazygit window";
};
package = mkOption {
type = with types; nullOr package;
default = pkgs.lazygit;
description = "The package to use for lazygit, null means do not install automatically";
};
};
};
}