treewide: Reformat with nixfmt

This commit is contained in:
traxys 2024-05-05 19:39:35 +02:00
parent c6281260dc
commit 62f32bfc71
459 changed files with 28139 additions and 26377 deletions

View file

@ -5,26 +5,24 @@
pkgs,
...
}:
with lib; {
options.plugins.rainbow-delimiters =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "rainbow-delimiters.nvim";
with lib;
{
options.plugins.rainbow-delimiters = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "rainbow-delimiters.nvim";
package =
helpers.mkPackageOption
"rainbow-delimiters.nvim"
pkgs.vimPlugins.rainbow-delimiters-nvim;
package = helpers.mkPackageOption "rainbow-delimiters.nvim" pkgs.vimPlugins.rainbow-delimiters-nvim;
strategy =
helpers.defaultNullOpts.mkNullable
strategy =
helpers.defaultNullOpts.mkNullable
(
with types;
attrsOf (
either
helpers.nixvimTypes.rawLua
(enum ["global" "local" "noop"])
)
attrsOf (
either helpers.nixvimTypes.rawLua (enum [
"global"
"local"
"noop"
])
)
)
''
{
@ -61,9 +59,8 @@ with lib; {
```
'';
query =
helpers.defaultNullOpts.mkNullable
(with types; attrsOf str)
query =
helpers.defaultNullOpts.mkNullable (with types; attrsOf str)
''
{
default = "rainbow-delimiters";
@ -75,8 +72,8 @@ with lib; {
See `|rb-delimiters-query|` for more information about queries.
'';
highlight =
helpers.defaultNullOpts.mkNullable (with types; listOf str)
highlight =
helpers.defaultNullOpts.mkNullable (with types; listOf str)
''
[
"RainbowDelimiterRed"
@ -93,20 +90,19 @@ with lib; {
`|rb-delimiters-colors|`.
'';
whitelist = helpers.mkNullOrOption (with types; listOf str) ''
List of Tree-sitter languages for which to enable rainbow delimiters.
Rainbow delimiters will be disabled for all other languages.
'';
whitelist = helpers.mkNullOrOption (with types; listOf str) ''
List of Tree-sitter languages for which to enable rainbow delimiters.
Rainbow delimiters will be disabled for all other languages.
'';
blacklist = helpers.mkNullOrOption (with types; listOf str) ''
List of Tree-sitter languages for which to disable rainbow delimiters.
Rainbow delimiters will be enabled for all other languages.
'';
blacklist = helpers.mkNullOrOption (with types; listOf str) ''
List of Tree-sitter languages for which to disable rainbow delimiters.
Rainbow delimiters will be enabled for all other languages.
'';
log = {
file =
helpers.defaultNullOpts.mkNullable
(with types; either str helpers.nixvimTypes.rawLua)
log = {
file =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
''
{
__raw = "vim.fn.stdpath('log') .. '/rainbow-delimiters.log'";
@ -117,22 +113,22 @@ with lib; {
(see `|standard-path|`).
'';
level = helpers.defaultNullOpts.mkLogLevel "warn" ''
Only messages equal to or above this value will be logged.
The default is to log warnings or above.
See `|log_levels|` for possible values.
'';
};
level = helpers.defaultNullOpts.mkLogLevel "warn" ''
Only messages equal to or above this value will be logged.
The default is to log warnings or above.
See `|log_levels|` for possible values.
'';
};
};
config = let
cfg = config.plugins.rainbow-delimiters;
in
config =
let
cfg = config.plugins.rainbow-delimiters;
in
mkIf cfg.enable {
warnings =
optional
(!config.plugins.treesitter.enable)
"Nixvim: treesitter-rainbow needs treesitter to function as intended";
warnings = optional (
!config.plugins.treesitter.enable
) "Nixvim: treesitter-rainbow needs treesitter to function as intended";
assertions = [
{
assertion = (cfg.whitelist == null) || (cfg.blacklist == null);
@ -144,53 +140,27 @@ with lib; {
}
];
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
globals.rainbow_delimiters = with cfg;
globals.rainbow_delimiters =
with cfg;
{
strategy =
helpers.ifNonNull' strategy
(
mapAttrs'
(
name: value: {
name =
if name == "default"
then "__emptyString"
else name;
value =
if isString value
then helpers.mkRaw "require 'rainbow-delimiters'.strategy['${value}']"
else value;
}
)
strategy
);
query =
helpers.ifNonNull' query
(
mapAttrs'
(
name: value: {
name =
if name == "default"
then "__emptyString"
else name;
inherit value;
}
)
query
);
inherit
highlight
whitelist
blacklist
;
strategy = helpers.ifNonNull' strategy (
mapAttrs' (name: value: {
name = if name == "default" then "__emptyString" else name;
value =
if isString value then helpers.mkRaw "require 'rainbow-delimiters'.strategy['${value}']" else value;
}) strategy
);
query = helpers.ifNonNull' query (
mapAttrs' (name: value: {
name = if name == "default" then "__emptyString" else name;
inherit value;
}) query
);
inherit highlight whitelist blacklist;
log = with log; {
inherit
file
level
;
inherit file level;
};
}
// cfg.extraOptions;