modules: add gitsigns
This commit is contained in:
parent
4cc9de194f
commit
238e4bf68e
3 changed files with 39 additions and 1 deletions
|
@ -129,7 +129,6 @@ let
|
||||||
|
|
||||||
genConfig = mkOption {
|
genConfig = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
readOnly = true;
|
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
./modules/plugins/style/neoformat.nix
|
./modules/plugins/style/neoformat.nix
|
||||||
./modules/plugins/navigation/telescope.nix
|
./modules/plugins/navigation/telescope.nix
|
||||||
./modules/plugins/navigation/nvim-tree.nix
|
./modules/plugins/navigation/nvim-tree.nix
|
||||||
|
./modules/plugins/gitsigns.nix
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
(pkgs.path + "/nixos/modules/misc/assertions.nix")
|
(pkgs.path + "/nixos/modules/misc/assertions.nix")
|
||||||
|
|
38
modules/plugins/gitsigns.nix
Normal file
38
modules/plugins/gitsigns.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let cfg = config.plugins.gitsigns; in
|
||||||
|
|
||||||
|
{
|
||||||
|
options.plugins.gitsigns = with lib; {
|
||||||
|
enable = mkEnableOption "gitsigns-nvim";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs.vimPlugins "gitsigns-nvim" { };
|
||||||
|
|
||||||
|
settings = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
keymap.set = mkOption {
|
||||||
|
type = with types; listOf keymap;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
fn.gitsigns-nvim-on-attach = {
|
||||||
|
args = [ "bufnr" ];
|
||||||
|
settings = { bufnr }: {
|
||||||
|
vim.keymap.set = map (attrs: attrs // { buffer = bufnr; }) cfg.keymap.set;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin.gitsigns-nvim = {
|
||||||
|
name = "gitsigns";
|
||||||
|
varName = "gs";
|
||||||
|
package = cfg.package;
|
||||||
|
setupSettings = cfg.settings // {
|
||||||
|
on_attach = config.fn.gitsigns-nvim-on-attach.lambda;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue