mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-20 10:45:51 +02:00
helpers/vim-plugin/mkVimPlugin: add optionsRenamedToSettings option
This commit is contained in:
parent
cef446a4da
commit
b8815f04a3
2 changed files with 32 additions and 6 deletions
|
@ -14,7 +14,7 @@ in
|
|||
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 nixvimUtils toLuaObject;};
|
||||
vim-plugin = import ./vim-plugin.nix {inherit lib nixvimOptions;};
|
||||
vim-plugin = import ./vim-plugin.nix {inherit lib nixvimOptions nixvimUtils;};
|
||||
inherit nixvimTypes;
|
||||
inherit toLuaObject;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
nixvimOptions,
|
||||
nixvimUtils,
|
||||
}:
|
||||
with lib; {
|
||||
mkVimPlugin = config: {
|
||||
|
@ -10,6 +11,7 @@ with lib; {
|
|||
imports ? [],
|
||||
# deprecations
|
||||
deprecateExtraConfig ? false,
|
||||
optionsRenamedToSettings ? [],
|
||||
# options
|
||||
originalName ? name,
|
||||
defaultPackage ? null,
|
||||
|
@ -88,12 +90,36 @@ with lib; {
|
|||
// pluginOptions
|
||||
// extraOptions;
|
||||
|
||||
imports =
|
||||
imports = let
|
||||
basePluginPath = [namespace name];
|
||||
settingsPath = basePluginPath ++ ["settings"];
|
||||
in
|
||||
imports
|
||||
++ optional (deprecateExtraConfig && createSettingsOption) (
|
||||
++ (
|
||||
optional
|
||||
(deprecateExtraConfig && createSettingsOption)
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
["plugins" name "extraConfig"]
|
||||
["plugins" name "settings"]
|
||||
(basePluginPath ++ ["extraConfig"])
|
||||
settingsPath
|
||||
)
|
||||
)
|
||||
++ (
|
||||
map
|
||||
(
|
||||
option: let
|
||||
optionPath =
|
||||
if isString option
|
||||
then [option]
|
||||
else option; # option is already a path (i.e. a list)
|
||||
|
||||
optionPathSnakeCase = map nixvimUtils.toSnakeCase optionPath;
|
||||
in
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ optionPath)
|
||||
(settingsPath ++ optionPathSnakeCase)
|
||||
)
|
||||
optionsRenamedToSettings
|
||||
);
|
||||
|
||||
config =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue