mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-03-01 06:24:28 +00:00
utility/ccc: add setupOpts option (#1294)
* utility/ccc: add inputs and outputs options Added `ccc.nvim` options `vim.utility.ccc.inputs` and `vim.utility.ccc.outputs` to make input color systems and output color formats configurable. * utility/ccc: add setupOpts option Added `ccc.nvim` option `vim.utility.ccc.setupOpts` with the existing hard-coded options as default values. * utility/ccc: no hidden mapping, better types - Remove hidden mapping input/output options into luaInline with prefixes. - Update types of setupOpts sub-options to avoid large blocks of inline Lua in the configuration. * utility/ccc: properly format with alejandra
This commit is contained in:
parent
9c75c2a199
commit
1bf757685b
3 changed files with 148 additions and 36 deletions
|
|
@ -5,7 +5,7 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
cfg = config.vim.utility.ccc;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
|
|
@ -13,40 +13,7 @@ in {
|
|||
|
||||
vim.pluginRC.ccc = entryAnywhere ''
|
||||
local ccc = require("ccc")
|
||||
ccc.setup {
|
||||
highlighter = {
|
||||
auto_enable = true,
|
||||
max_byte = 2 * 1024 * 1024, -- 2mb
|
||||
lsp = true,
|
||||
filetypes = colorPickerFts,
|
||||
},
|
||||
pickers = {
|
||||
ccc.picker.hex,
|
||||
ccc.picker.css_rgb,
|
||||
ccc.picker.css_hsl,
|
||||
ccc.picker.ansi_escape {
|
||||
meaning1 = "bright", -- whether the 1 means bright or yellow
|
||||
},
|
||||
},
|
||||
alpha_show = "hide", -- needed when highlighter.lsp is set to true
|
||||
recognize = { output = true }, -- automatically recognize color format under cursor
|
||||
inputs = { ccc.input.hsl },
|
||||
outputs = {
|
||||
ccc.output.css_hsl,
|
||||
ccc.output.css_rgb,
|
||||
ccc.output.hex,
|
||||
},
|
||||
convert = {
|
||||
{ ccc.picker.hex, ccc.output.css_hsl },
|
||||
{ ccc.picker.css_rgb, ccc.output.css_hsl },
|
||||
{ ccc.picker.css_hsl, ccc.output.hex },
|
||||
},
|
||||
mappings = {
|
||||
["q"] = ccc.mapping.quit,
|
||||
["L"] = ccc.mapping.increase10,
|
||||
["H"] = ccc.mapping.decrease10,
|
||||
},
|
||||
}
|
||||
ccc.setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue