mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-02 17:15:55 +00:00
modules: start breaking down core modules; simplify tree structure
This commit is contained in:
parent
4703ed7731
commit
370913e827
242 changed files with 178 additions and 124 deletions
94
modules/plugins/ui/colorizer/colorizer.nix
Normal file
94
modules/plugins/ui/colorizer/colorizer.nix
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
in {
|
||||
options.vim.ui.colorizer = {
|
||||
enable = mkEnableOption "nvim-colorizer.lua for color highlighting";
|
||||
|
||||
filetypes = mkOption {
|
||||
type = with types; attrsOf attrs;
|
||||
default = {
|
||||
css = {};
|
||||
scss = {};
|
||||
};
|
||||
description = "Filetypes to highlight on";
|
||||
};
|
||||
|
||||
options = {
|
||||
rgb = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "#RGB hex codes";
|
||||
};
|
||||
|
||||
rrggbb = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "#RRGGBB hex codes";
|
||||
};
|
||||
|
||||
names = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''"Name" codes such as "Blue"'';
|
||||
};
|
||||
|
||||
rgb_fn = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "CSS rgb() and rgba() functions";
|
||||
};
|
||||
|
||||
rrggbbaa = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "#RRGGBBAA hex codes";
|
||||
};
|
||||
|
||||
hsl_fn = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "CSS hsl() and hsla() functions";
|
||||
};
|
||||
|
||||
css = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB";
|
||||
};
|
||||
|
||||
css_fn = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable all CSS *functions*: rgb_fn, hsl_fn";
|
||||
};
|
||||
|
||||
mode = mkOption {
|
||||
type = types.enum ["foreground" "background"];
|
||||
default = "background";
|
||||
description = "Set the display mode";
|
||||
};
|
||||
|
||||
tailwind = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable tailwind colors";
|
||||
};
|
||||
|
||||
sass = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable sass colors";
|
||||
};
|
||||
|
||||
alwaysUpdate = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Update color values even if buffer is not focused, like when using cmp_menu, cmp_docs";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
36
modules/plugins/ui/colorizer/config.nix
Normal file
36
modules/plugins/ui/colorizer/config.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim boolToString;
|
||||
|
||||
cfg = config.vim.ui.colorizer;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"nvim-colorizer-lua"
|
||||
];
|
||||
|
||||
vim.luaConfigRC.colorizer = nvim.dag.entryAnywhere ''
|
||||
require('colorizer').setup({
|
||||
filetypes = ${nvim.lua.attrsetToLuaTable cfg.filetypes},
|
||||
user_default_options = {
|
||||
RGB = ${boolToString cfg.options.rgb};
|
||||
RRGGBB = ${boolToString cfg.options.rrggbb};
|
||||
names = ${boolToString cfg.options.names};
|
||||
RRGGBBAA = ${boolToString cfg.options.rrggbbaa};
|
||||
rgb_fn = ${boolToString cfg.options.rgb_fn};
|
||||
hsl_fn = ${boolToString cfg.options.hsl_fn};
|
||||
css = ${boolToString cfg.options.css};
|
||||
css_fn = ${boolToString cfg.options.css_fn};
|
||||
mode = '${toString cfg.options.mode}';
|
||||
tailwind = ${boolToString cfg.options.tailwind};
|
||||
sass = ${boolToString cfg.options.tailwind};
|
||||
always_update = ${boolToString cfg.options.alwaysUpdate};
|
||||
}
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
||||
6
modules/plugins/ui/colorizer/default.nix
Normal file
6
modules/plugins/ui/colorizer/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./colorizer.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue