diff --git a/lib/helpers.nix b/lib/helpers.nix index 3a9f8cf3..5bf50b11 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -13,7 +13,7 @@ in maintainers = import ./maintainers.nix; keymaps = import ./keymap-helpers.nix {inherit lib nixvimOptions nixvimTypes;}; autocmd = import ./autocmd-helpers.nix {inherit lib nixvimOptions nixvimTypes;}; - neovim-plugin = import ./neovim-plugin.nix {inherit lib nixvimOptions toLuaObject;}; + neovim-plugin = import ./neovim-plugin.nix {inherit lib nixvimOptions nixvimUtils toLuaObject;}; vim-plugin = import ./vim-plugin.nix {inherit lib nixvimOptions;}; inherit nixvimTypes; inherit toLuaObject; diff --git a/lib/neovim-plugin.nix b/lib/neovim-plugin.nix index ac9ff3e8..7f47f7f9 100644 --- a/lib/neovim-plugin.nix +++ b/lib/neovim-plugin.nix @@ -2,6 +2,7 @@ lib, nixvimOptions, toLuaObject, + nixvimUtils, }: with lib; rec { mkSettingsOption = { @@ -34,6 +35,9 @@ with lib; rec { namespace ? "plugins", maintainers, imports ? [], + # deprecations + deprecateExtraConfig ? false, + optionsRenamedToSettings ? [], # options originalName ? name, defaultPackage, @@ -49,7 +53,29 @@ with lib; rec { }: { meta.maintainers = maintainers; - inherit imports; + imports = let + basePluginPath = [namespace name]; + in + imports + ++ ( + optional + deprecateExtraConfig + ( + mkRenamedOptionModule + (basePluginPath ++ ["extraConfig"]) + (basePluginPath ++ ["settings"]) + ) + ) + ++ ( + map + ( + optionName: + mkRenamedOptionModule + (basePluginPath ++ [optionName]) + (basePluginPath ++ ["settings" (nixvimUtils.toSnakeCase optionName)]) + ) + optionsRenamedToSettings + ); options.${namespace}.${name} = {