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;};
|
keymaps = import ./keymap-helpers.nix {inherit lib nixvimOptions nixvimTypes;};
|
||||||
autocmd = import ./autocmd-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;};
|
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 nixvimTypes;
|
||||||
inherit toLuaObject;
|
inherit toLuaObject;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
nixvimOptions,
|
nixvimOptions,
|
||||||
|
nixvimUtils,
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib; {
|
||||||
mkVimPlugin = config: {
|
mkVimPlugin = config: {
|
||||||
|
@ -10,6 +11,7 @@ with lib; {
|
||||||
imports ? [],
|
imports ? [],
|
||||||
# deprecations
|
# deprecations
|
||||||
deprecateExtraConfig ? false,
|
deprecateExtraConfig ? false,
|
||||||
|
optionsRenamedToSettings ? [],
|
||||||
# options
|
# options
|
||||||
originalName ? name,
|
originalName ? name,
|
||||||
defaultPackage ? null,
|
defaultPackage ? null,
|
||||||
|
@ -88,12 +90,36 @@ with lib; {
|
||||||
// pluginOptions
|
// pluginOptions
|
||||||
// extraOptions;
|
// extraOptions;
|
||||||
|
|
||||||
imports =
|
imports = let
|
||||||
|
basePluginPath = [namespace name];
|
||||||
|
settingsPath = basePluginPath ++ ["settings"];
|
||||||
|
in
|
||||||
imports
|
imports
|
||||||
++ optional (deprecateExtraConfig && createSettingsOption) (
|
++ (
|
||||||
mkRenamedOptionModule
|
optional
|
||||||
["plugins" name "extraConfig"]
|
(deprecateExtraConfig && createSettingsOption)
|
||||||
["plugins" name "settings"]
|
(
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(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 =
|
config =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue