mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-21 17:59:48 +01:00
feat: color previews via nvim-colorizer-lua
This commit is contained in:
parent
1cc6bb8b8a
commit
471677d403
8 changed files with 130 additions and 4 deletions
|
@ -179,11 +179,11 @@ inputs: let
|
|||
vim.ui = {
|
||||
noice.enable = true;
|
||||
smartcolumn.enable = true;
|
||||
colorizer.enable = true;
|
||||
};
|
||||
|
||||
vim.assistant = {
|
||||
copilot.enable = isMaximal;
|
||||
#tabnine.enable = false; # FIXME: this is not working because the plugin depends on an internal script to be ran by the package manager
|
||||
};
|
||||
|
||||
vim.session = {
|
||||
|
|
17
flake.lock
17
flake.lock
|
@ -964,6 +964,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-colorizer-lua": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1591879145,
|
||||
"narHash": "sha256-6YrnItxExL2C8pNIdLd+hXCjsB2MbZANwWkah6dreD8=",
|
||||
"owner": "norcalli",
|
||||
"repo": "nvim-colorizer.lua",
|
||||
"rev": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "norcalli",
|
||||
"repo": "nvim-colorizer.lua",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-compe": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1325,6 +1341,7 @@
|
|||
"nvim-bufferline-lua": "nvim-bufferline-lua",
|
||||
"nvim-cmp": "nvim-cmp",
|
||||
"nvim-code-action-menu": "nvim-code-action-menu",
|
||||
"nvim-colorizer-lua": "nvim-colorizer-lua",
|
||||
"nvim-compe": "nvim-compe",
|
||||
"nvim-cursorline": "nvim-cursorline",
|
||||
"nvim-lightbulb": "nvim-lightbulb",
|
||||
|
|
|
@ -451,6 +451,11 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
nvim-colorizer-lua = {
|
||||
url = "github:norcalli/nvim-colorizer.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Assistant
|
||||
copilot-lua = {
|
||||
url = "github:zbirenbaum/copilot.lua";
|
||||
|
|
|
@ -81,9 +81,7 @@ with lib; let
|
|||
"project-nvim"
|
||||
"elixir-ls"
|
||||
"elixir-tools"
|
||||
"vim-svelte"
|
||||
"vim-javascript"
|
||||
"vim-html"
|
||||
"nvim-colorizer-lua"
|
||||
];
|
||||
# You can either use the name of the plugin or a package.
|
||||
pluginsType = with types;
|
||||
|
|
67
modules/ui/colorizer/colorizer.nix
Normal file
67
modules/ui/colorizer/colorizer.nix
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; {
|
||||
options.vim.ui.colorizer = {
|
||||
enable = mkEnableOption "Enable nvim-colorizer.lua for color highlighting";
|
||||
|
||||
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 = true;
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
32
modules/ui/colorizer/config.nix
Normal file
32
modules/ui/colorizer/config.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
cfg = config.vim.ui.colorizer;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"nvim-colorizer-lua"
|
||||
];
|
||||
|
||||
vim.luaConfigRC.colorizer = nvim.dag.entryAnywhere ''
|
||||
require('colorizer').setup({
|
||||
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}';
|
||||
}
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/ui/colorizer/default.nix
Normal file
6
modules/ui/colorizer/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./colorizer.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
|
@ -4,5 +4,6 @@ _: {
|
|||
./modes
|
||||
./notifications
|
||||
./smartcolumn
|
||||
./colorizer
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue