From 9888a277adc8a34aa13e9f6bb75c9c86b4f2919a Mon Sep 17 00:00:00 2001 From: raf Date: Mon, 6 Jan 2025 03:54:38 +0300 Subject: [PATCH] git/gitsigns: migrate to `setupOpts` (#524) * git/gitsigns: add `setupOpts` module option for user-specified setup table * docs: update v0.8 release notes --- docs/release-notes/rl-0.8.md | 3 +++ modules/plugins/git/gitsigns/config.nix | 3 ++- modules/plugins/git/gitsigns/gitsigns.nix | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index e41911ba..16ec2863 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -13,6 +13,9 @@ - Add [render-markdown.nvim] under `languages.markdown.extensions.render-markdown-nvim` +- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table + in gitsigns configuration. + [amadaluzia](https://github.com/amadaluzia): [haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim diff --git a/modules/plugins/git/gitsigns/config.nix b/modules/plugins/git/gitsigns/config.nix index 039ab635..9aee73b7 100644 --- a/modules/plugins/git/gitsigns/config.nix +++ b/modules/plugins/git/gitsigns/config.nix @@ -7,6 +7,7 @@ inherit (lib.modules) mkIf mkMerge; inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault; inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.git.gitsigns; @@ -70,7 +71,7 @@ in { }; pluginRC.gitsigns = entryAnywhere '' - require('gitsigns').setup{} + require('gitsigns').setup(${toLuaObject cfg.setupOpts}) ''; }; } diff --git a/modules/plugins/git/gitsigns/gitsigns.nix b/modules/plugins/git/gitsigns/gitsigns.nix index ef880bce..9c2375d8 100644 --- a/modules/plugins/git/gitsigns/gitsigns.nix +++ b/modules/plugins/git/gitsigns/gitsigns.nix @@ -6,6 +6,7 @@ inherit (lib.options) mkEnableOption; inherit (lib.modules) mkRenamedOptionModule; inherit (lib.nvim.binds) mkMappingOption; + inherit (lib.nvim.types) mkPluginSetupOption; in { imports = [ (mkRenamedOptionModule ["vim" "git" "gitsigns" "codeActions" "vim" "gitsigns" "codeActions"] ["vim" "git" "gitsigns" "codeActions" "enable"]) @@ -13,6 +14,7 @@ in { options.vim.git.gitsigns = { enable = mkEnableOption "gitsigns" // {default = config.vim.git.enable;}; + setupOpts = mkPluginSetupOption "gitsigns" {}; codeActions.enable = mkEnableOption "gitsigns codeactions through null-ls";