mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-14 04:55:57 +01:00
Compare commits
4 commits
d8cc5263b0
...
f293624fc1
Author | SHA1 | Date | |
---|---|---|---|
|
f293624fc1 | ||
|
7d9f1e0481 | ||
|
82e92a56da | ||
|
981fe07075 |
2 changed files with 58 additions and 18 deletions
|
@ -4,8 +4,9 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) attrsOf enum nullOr submodule bool;
|
inherit (lib.types) attrsOf enum nullOr submodule bool str;
|
||||||
inherit (lib.modules) mkRenamedOptionModule;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
|
||||||
settingSubmodule = submodule {
|
settingSubmodule = submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -33,6 +34,12 @@
|
||||||
type = nullOr bool;
|
type = nullOr bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
AARRGGBB = mkOption {
|
||||||
|
description = "Colorize 0xAARRGGBB hex codes";
|
||||||
|
default = null;
|
||||||
|
type = nullOr bool;
|
||||||
|
};
|
||||||
|
|
||||||
rgb_fn = mkOption {
|
rgb_fn = mkOption {
|
||||||
description = "Colorize CSS rgb() and rgba() functions";
|
description = "Colorize CSS rgb() and rgba() functions";
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -57,37 +64,70 @@
|
||||||
type = nullOr bool;
|
type = nullOr bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tailwind = mkOption {
|
||||||
|
description = "Enable tailwind colors";
|
||||||
|
default = null;
|
||||||
|
type = nullOr bool;
|
||||||
|
};
|
||||||
|
|
||||||
|
sass = mkOption {
|
||||||
|
description = "Enable sass colors";
|
||||||
|
default = null;
|
||||||
|
type = nullOr bool;
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualtext = mkOption {
|
||||||
|
description = "String to display as virtualtext";
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
description = "Set the display mode";
|
description = "Set the display mode";
|
||||||
type = nullOr (enum ["foreground" "background"]);
|
type = nullOr (enum ["foreground" "background"]);
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
always_update = mkOption {
|
||||||
|
description = "Update color values even if buffer is not focused. Example use: cmp_menu, cmp_docs";
|
||||||
|
default = null;
|
||||||
|
type = nullOr bool;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule ["vim" "ui" "colorizer" "setupOpts" "defaultOptions"] ["vim" "ui" "colorizer" "options"])
|
(mkRenamedOptionModule ["vim" "ui" "colorizer" "options"] ["vim" "ui" "colorizer" "setupOpts" "defaultOptions"])
|
||||||
(mkRenamedOptionModule ["vim" "ui" "colorizer" "setupOpts" "filetypes"] ["vim" "ui" "colorizer" "filetypes"])
|
(mkRenamedOptionModule ["vim" "ui" "colorizer" "filetypes"] ["vim" "ui" "colorizer" "setupOpts" "filetypes"])
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.ui.colorizer = {
|
options.vim.ui.colorizer = {
|
||||||
enable = mkEnableOption "color highlighting [nvim-colorizer.lua]";
|
enable = mkEnableOption "color highlighting [nvim-colorizer.lua]";
|
||||||
|
|
||||||
# colorizer has a non-standard setup function (takes two args), so we're not using setupOpts
|
setupOpts = mkPluginSetupOption "colorizer" {
|
||||||
options = mkOption {
|
filetypes = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Default options that apply to all filetypes. Filetype specific settings from
|
Filetypes to enable on and their option overrides.
|
||||||
[filetypes](#opt-vim.ui.colorizer.filetypes) take precedence.
|
|
||||||
'';
|
|
||||||
default = {};
|
|
||||||
type = settingSubmodule;
|
|
||||||
};
|
|
||||||
|
|
||||||
filetypes = mkOption {
|
"*" means enable on all filetypes. Filetypes prefixed with "!" are disabled.
|
||||||
description = "Filetype specific settings";
|
'';
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
example = {
|
||||||
freeformType = attrsOf settingSubmodule;
|
"*" = {};
|
||||||
|
"!vim" = {};
|
||||||
|
javascript = {
|
||||||
|
AARRGGBB = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
type = submodule {
|
||||||
|
freeformType = attrsOf settingSubmodule;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
user_default_options = mkOption {
|
||||||
|
description = "Default options";
|
||||||
|
default = {};
|
||||||
|
type = settingSubmodule;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@ in {
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.colorizer = entryAnywhere ''
|
vim.luaConfigRC.colorizer = entryAnywhere ''
|
||||||
require('colorizer').setup(${toLuaObject cfg.filetypes}, ${toLuaObject cfg.options})
|
require('colorizer').setup(${toLuaObject cfg.setupOpts})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue