diff --git a/lib/vim-plugin.nix b/lib/vim-plugin.nix index 045f4e61..e67695f0 100644 --- a/lib/vim-plugin.nix +++ b/lib/vim-plugin.nix @@ -11,6 +11,7 @@ with lib; { extraPackages ? [], options ? {}, globalPrefix ? "", + addExtraConfigRenameWarning ? false, ... }: let cfg = config.plugins.${name}; @@ -44,10 +45,12 @@ with lib; { package = nixvimOptions.mkPackageOption name package; }; + createSettingsOption = (isString globalPrefix) && (globalPrefix != ""); + extraConfigOption = - if (isString globalPrefix) && (globalPrefix != "") - then { - extraConfig = mkOption { + optionalAttrs createSettingsOption + { + settings = mkOption { type = with types; attrsOf anything; description = '' The configuration options for ${name} without the '${globalPrefix}' prefix. @@ -60,8 +63,7 @@ with lib; { ''; default = {}; }; - } - else {}; + }; in { options.plugins.${name} = { @@ -75,6 +77,12 @@ with lib; { // packageOption // pluginOptions; + imports = optional (addExtraConfigRenameWarning && createSettingsOption) ( + mkRenamedOptionModule + ["plugins" name "extraConfig"] + ["plugins" name "settings"] + ); + config = mkIf cfg.enable { inherit extraPackages globals; # does this evaluate package? it would not be desired to evaluate pacakge if we use another package.