mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 10:51:36 +00:00
modules/ui: switch to explicit lib calls
This commit is contained in:
parent
81b9a8a95c
commit
a7531186a8
25 changed files with 251 additions and 272 deletions
|
@ -1,15 +1,12 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf attrs bool enum;
|
||||
in {
|
||||
options.vim.ui.colorizer = {
|
||||
enable = mkEnableOption "nvim-colorizer.lua for color highlighting";
|
||||
enable = mkEnableOption "color highlighting [nvim-colorizer.lua]";
|
||||
|
||||
filetypes = mkOption {
|
||||
type = with types; attrsOf attrs;
|
||||
type = attrsOf attrs;
|
||||
default = {
|
||||
css = {};
|
||||
scss = {};
|
||||
|
@ -18,77 +15,54 @@ in {
|
|||
};
|
||||
|
||||
options = {
|
||||
alwaysUpdate = mkEnableOption "updating color values even if buffer is not focused, like when using cmp_menu, cmp_docs";
|
||||
|
||||
rgb = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "#RGB hex codes";
|
||||
};
|
||||
|
||||
rrggbb = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "#RRGGBB hex codes";
|
||||
};
|
||||
|
||||
names = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''"Name" codes such as "Blue"'';
|
||||
};
|
||||
|
||||
rgb_fn = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "CSS rgb() and rgba() functions";
|
||||
};
|
||||
|
||||
rrggbbaa = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "#RRGGBBAA hex codes";
|
||||
};
|
||||
|
||||
hsl_fn = mkOption {
|
||||
type = types.bool;
|
||||
type = 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"];
|
||||
type = 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";
|
||||
};
|
||||
tailwind = mkEnableOption "tailwind colors";
|
||||
sass = mkEnableOption "sass colors";
|
||||
css = mkEnableOption "all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB";
|
||||
css_fn = mkEnableOption "all CSS *functions*: rgb_fn, hsl_fn";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim boolToString;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.nvim.lua) attrsetToLuaTable;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.ui.colorizer;
|
||||
in {
|
||||
|
@ -13,14 +15,14 @@ in {
|
|||
"nvim-colorizer-lua"
|
||||
];
|
||||
|
||||
vim.luaConfigRC.colorizer = nvim.dag.entryAnywhere ''
|
||||
vim.luaConfigRC.colorizer = entryAnywhere ''
|
||||
require('colorizer').setup({
|
||||
filetypes = ${nvim.lua.attrsetToLuaTable cfg.filetypes},
|
||||
filetypes = ${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};
|
||||
names = ${boolToString cfg.options.names};
|
||||
rgb_fn = ${boolToString cfg.options.rgb_fn};
|
||||
hsl_fn = ${boolToString cfg.options.hsl_fn};
|
||||
css = ${boolToString cfg.options.css};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
imports = [
|
||||
./colorizer.nix
|
||||
./config.nix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue