mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 13:19:48 +01:00
(lazygit) add option package
This commit is contained in:
parent
f8ff3cd9fa
commit
2018cd7b2f
2 changed files with 17 additions and 3 deletions
|
@ -9,7 +9,8 @@ with builtins; let
|
||||||
toggleKey = "<c-t>";
|
toggleKey = "<c-t>";
|
||||||
in {
|
in {
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
(mkIf cfg.enable {
|
(
|
||||||
|
mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = [
|
||||||
"toggleterm-nvim"
|
"toggleterm-nvim"
|
||||||
];
|
];
|
||||||
|
@ -39,10 +40,17 @@ in {
|
||||||
(
|
(
|
||||||
mkIf (cfg.enable && cfg.lazygit.enable)
|
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 terminal = require 'toggleterm.terminal'
|
||||||
local lazygit = terminal.Terminal:new({
|
local lazygit = terminal.Terminal:new({
|
||||||
cmd = "lazygit",
|
cmd = '${
|
||||||
|
if (cfg.lazygit.package != null)
|
||||||
|
then getExe cfg.lazygit.package
|
||||||
|
else "lazygit"
|
||||||
|
}',
|
||||||
direction = '${cfg.lazygit.direction}',
|
direction = '${cfg.lazygit.direction}',
|
||||||
hidden = true,
|
hidden = true,
|
||||||
on_open = function(term)
|
on_open = function(term)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
|
@ -24,6 +25,11 @@ with builtins; {
|
||||||
default = "float";
|
default = "float";
|
||||||
description = "Direction of the lazygit window";
|
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";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue