mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-01 21:04:30 +02:00
treewide: Reformat with nixfmt
This commit is contained in:
parent
c6281260dc
commit
62f32bfc71
459 changed files with 28139 additions and 26377 deletions
|
@ -4,44 +4,44 @@
|
|||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib; rec {
|
||||
mkExtension = {
|
||||
name,
|
||||
defaultPackage,
|
||||
extensionName ? name,
|
||||
settingsOptions ? {},
|
||||
settingsExample ? null,
|
||||
extraOptions ? {},
|
||||
imports ? [],
|
||||
optionsRenamedToSettings ? [],
|
||||
extraConfig ? cfg: {},
|
||||
}: {
|
||||
# TODO remove this once all deprecation warnings will have been removed.
|
||||
imports = let
|
||||
basePluginPath = ["plugins" "telescope" "extensions" name];
|
||||
settingsPath = basePluginPath ++ ["settings"];
|
||||
in
|
||||
imports
|
||||
++ (
|
||||
map
|
||||
(
|
||||
option: let
|
||||
optionPath =
|
||||
if isString option
|
||||
then [option]
|
||||
else option; # option is already a path (i.e. a list)
|
||||
with lib;
|
||||
rec {
|
||||
mkExtension =
|
||||
{
|
||||
name,
|
||||
defaultPackage,
|
||||
extensionName ? name,
|
||||
settingsOptions ? { },
|
||||
settingsExample ? null,
|
||||
extraOptions ? { },
|
||||
imports ? [ ],
|
||||
optionsRenamedToSettings ? [ ],
|
||||
extraConfig ? cfg: { },
|
||||
}:
|
||||
{
|
||||
# TODO remove this once all deprecation warnings will have been removed.
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"telescope"
|
||||
"extensions"
|
||||
name
|
||||
];
|
||||
settingsPath = basePluginPath ++ [ "settings" ];
|
||||
in
|
||||
imports
|
||||
++ (map (
|
||||
option:
|
||||
let
|
||||
optionPath = if isString option then [ option ] else option; # option is already a path (i.e. a list)
|
||||
|
||||
optionPathSnakeCase = map helpers.toSnakeCase optionPath;
|
||||
in
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ optionPath)
|
||||
(settingsPath ++ optionPathSnakeCase)
|
||||
)
|
||||
optionsRenamedToSettings
|
||||
);
|
||||
mkRenamedOptionModule (basePluginPath ++ optionPath) (settingsPath ++ optionPathSnakeCase)
|
||||
) optionsRenamedToSettings);
|
||||
|
||||
options.plugins.telescope.extensions.${name} =
|
||||
{
|
||||
options.plugins.telescope.extensions.${name} = {
|
||||
enable = mkEnableOption "the `${name}` telescope extension";
|
||||
|
||||
package = helpers.mkPackageOption name defaultPackage;
|
||||
|
@ -51,32 +51,30 @@ with lib; rec {
|
|||
options = settingsOptions;
|
||||
example = settingsExample;
|
||||
};
|
||||
}
|
||||
// extraOptions;
|
||||
} // extraOptions;
|
||||
|
||||
config = let
|
||||
cfg = config.plugins.telescope.extensions.${name};
|
||||
in
|
||||
mkIf cfg.enable
|
||||
(
|
||||
mkMerge [
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.telescope.extensions.${name};
|
||||
in
|
||||
mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.telescope = {
|
||||
enabledExtensions = [extensionName];
|
||||
enabledExtensions = [ extensionName ];
|
||||
settings.extensions.${extensionName} = cfg.settings;
|
||||
};
|
||||
}
|
||||
(extraConfig cfg)
|
||||
]
|
||||
);
|
||||
};
|
||||
]);
|
||||
};
|
||||
|
||||
mkModeMappingsOption = mode: defaults:
|
||||
mkModeMappingsOption =
|
||||
mode: defaults:
|
||||
mkOption {
|
||||
type = with helpers.nixvimTypes; attrsOf strLuaFn;
|
||||
default = {};
|
||||
default = { };
|
||||
description = ''
|
||||
Keymaps in ${mode} mode.
|
||||
|
||||
|
@ -88,11 +86,10 @@ with lib; rec {
|
|||
apply = mapAttrs (_: helpers.mkRaw);
|
||||
};
|
||||
|
||||
mkMappingsOption = {
|
||||
insertDefaults,
|
||||
normalDefaults,
|
||||
}: {
|
||||
i = mkModeMappingsOption "insert" insertDefaults;
|
||||
n = mkModeMappingsOption "normal" normalDefaults;
|
||||
};
|
||||
mkMappingsOption =
|
||||
{ insertDefaults, normalDefaults }:
|
||||
{
|
||||
i = mkModeMappingsOption "insert" insertDefaults;
|
||||
n = mkModeMappingsOption "normal" normalDefaults;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue