Merge branch 'main' into main

This commit is contained in:
raf 2026-01-10 23:41:33 +03:00 committed by GitHub
commit 7267cf3570
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 1044 additions and 591 deletions

View file

@ -308,5 +308,39 @@ in {
])
# Migrated via batchRenameOptions. Further batch renames must be below this line.
renamedVimOpts
# 2026-01-06
[
(mkRemovedOptionModule ["vim" "treesitter" "highlight" "disable"] ''
Treesitter highlighting is now handled by Neovim natively, and it does not have a disable option.
'')
(mkRemovedOptionModule ["vim" "treesitter" "highlight" "additionalVimRegexHighlighting"] ''
Treesitter highlighting is now handled by Neovim natively, and it does not have a additionalVimRegexHighlighting option.
'')
(mkRemovedOptionModule ["vim" "treesitter" "indent" "disable"] ''
Treesitter indentation is now handled differently, and it does not have a disable option.
'')
(mkRemovedOptionModule ["vim" "treesitter" "incrementalSelection" "enable"] ''
Incremental selection configuration has been removed from nvim-treesitter.
'')
(mkRemovedOptionModule ["vim" "treesitter" "incrementalSelection" "disable"] ''
Incremental selection configuration has been removed from nvim-treesitter.
'')
(mkRemovedOptionModule ["vim" "treesitter" "mappings" "incrementalSelection" "init"] ''
Incremental selection configuration has been removed from nvim-treesitter.
'')
(mkRemovedOptionModule ["vim" "treesitter" "mappings" "incrementalSelection" "incrementByNode"] ''
Incremental selection configuration has been removed from nvim-treesitter.
'')
(
mkRemovedOptionModule ["vim" "treesitter" "mappings" "incrementalSelection" "incrementByScope"]
''
Incremental selection configuration has been removed from nvim-treesitter.
''
)
(mkRemovedOptionModule ["vim" "treesitter" "mappings" "incrementalSelection" "decrementByNode"] ''
Incremental selection configuration has been removed from nvim-treesitter.
'')
]
];
}

View file

@ -178,7 +178,7 @@ in {
treesitter = {
enable = mkEnableOption "C# treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "c-sharp";
package = mkGrammarOption pkgs "c_sharp";
};
lsp = {

View file

@ -64,7 +64,7 @@ in {
description = "Enable Markdown treesitter";
};
mdPackage = mkGrammarOption pkgs "markdown";
mdInlinePackage = mkGrammarOption pkgs "markdown-inline";
mdInlinePackage = mkGrammarOption pkgs "markdown_inline";
};
lsp = {

View file

@ -41,7 +41,7 @@
};
nixfmt = {
command = getExe pkgs.nixfmt-rfc-style;
command = getExe pkgs.nixfmt;
};
};

View file

@ -228,7 +228,7 @@ in {
package = mkOption {
description = "Python treesitter grammar to use";
type = package;
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.python;
default = pkgs.vimPlugins.nvim-treesitter.grammarPlugins.python;
};
};

View file

@ -66,7 +66,7 @@ in {
package = mkOption {
type = package;
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.sql;
default = pkgs.vimPlugins.nvim-treesitter.grammarPlugins.sql;
description = "SQL treesitter grammar to use";
};
};

View file

@ -3,9 +3,9 @@
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) pushDownDefault;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.notes.obsidian;
@ -18,13 +18,58 @@ in {
"tabular"
];
binds.whichKey.register = pushDownDefault {
"<leader>o" = "+Notes";
};
pluginRC.obsidian = entryAnywhere ''
require("obsidian").setup(${toLuaObject cfg.setupOpts})
'';
notes.obsidian.setupOpts = let
# may not be defined
snacks-picker.enable = config.vim.utility.snacks-nvim.setupOpts.picker.enabled or false;
mini-pick = config.vim.mini.pick;
inherit (config.vim) telescope fzf-lua;
inherit (config.vim.languages.markdown.extensions) render-markdown-nvim markview-nvim;
in
mkMerge [
# Don't set option unless we have a useful setting for it.
(mkIf (snacks-picker.enable || mini-pick.enable || telescope.enable || fzf-lua.enable) {
# It doesn't detect/choose this.
# Some pickers and completion plugins don't get detected correctly by the checkhealth, but they all work.
# Values taken from the [config's](https://github.com/obsidian-nvim/obsidian.nvim/blob/main/lua/obsidian/config/init.lua) valid ones.
picker.name =
if snacks-picker.enable
then "snacks.pick"
else if mini-pick.enable
then "mini.pick"
else if telescope.enable
then "telescope.nvim"
else if fzf-lua.enable
then "fzf-lua"
# NOTE: Shouldn't happen with the if-guard.
else null;
})
# Should be disabled automatically, but still shows up in render-markdown's checkhealth.
# This is also useful in that it will conflict with a user explicitly enabling it
# without mkForce, which is probably a copy paste issue and a sign to look at
# whether this option is useful.
(mkIf (render-markdown-nvim.enable || markview-nvim.enable) {ui.enable = false;})
];
# Resolve markdown image paths in the vault.
# Only actually used by snacks if image.enabled is set to true and
# required programs are supplied and `attachments.img_folder` is correct.
# From https://github.com/obsidian-nvim/obsidian.nvim/wiki/Images,
# which notes the API might change.
utility.snacks-nvim.setupOpts = mkIf config.vim.utility.snacks-nvim.enable {
image.resolve = mkLuaInline ''
function(path, src)
if require("obsidian.api").path_is_note(path) then
return require("obsidian.api").resolve_image_path(src)
end
end
'';
};
};
};
}

View file

@ -1,14 +1,7 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool str nullOr;
inherit (lib.modules) mkRenamedOptionModule;
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.modules) mkRenamedOptionModule mkRemovedOptionModule;
inherit (lib.nvim.types) mkPluginSetupOption;
autocompleteCfg = config.vim.autocomplete;
in {
imports = let
renamedSetupOption = oldPath: newPath:
@ -16,38 +9,60 @@ in {
(["vim" "notes" "obsidian"] ++ oldPath)
(["vim" "notes" "obsidian" "setupOpts"] ++ newPath);
in [
(renamedSetupOption ["dir"] ["dir"])
(
mkRemovedOptionModule ["vim" "notes" "obsidian" "dir"]
''
`obsidian.nvim` has migrated to the `setupOpts.workspaces` option to support multiple vaults with a single interface.
To continue using a single vault, set:
```nix
{
notes.obsidian.setupOpts.workspaces = [
{
name = "any-string";
path = "~/old/dir/path/value";
}
];
}
```
See the [wiki](https://github.com/obsidian-nvim/obsidian.nvim/wiki/Workspace#vault-based-workspaces) for more information.
''
)
(renamedSetupOption ["daily-notes" "folder"] ["daily_notes" "folder"])
(renamedSetupOption ["daily-notes" "date-format"] ["daily_notes" "date_format"])
(renamedSetupOption ["completion"] ["completion"])
];
options.vim.notes = {
obsidian = {
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
enable =
mkEnableOption ""
// {
description = ''
Whether to enable plugins to complement the Obsidian markdown editor [obsidian.nvim].
setupOpts = mkPluginSetupOption "Obsidian.nvim" {
daily_notes = {
folder = mkOption {
type = nullOr str;
default = null;
description = "Directory in which daily notes should be created";
};
date_format = mkOption {
type = nullOr str;
default = null;
description = "Date format used for creating daily notes";
};
Enables [vim-markdown] which automatically folds markdown headings inside and outside of workspaces/vaults.
Set {option}`vim.globals.vim_markdown_folding_disable = 1;` to disable automatic folding,
or {option}`vim.globals.vim_markdown_folding_level = <heading-level-int>;` to set the default fold level for new buffers.
nvf will choose one of `snacks.picker`, `mini.pick`, `telescope`, or `fzf-lua` as the `obsidian.nvim` picker based on whether they are enabled, in that order.
You can enable one of them with one of the following:
- {option}`vim.utility.snacks-nvim.setupOpts.picker.enabled` and {option}`vim.utility.snacks-nvim.enable`
- {option}`vim.mini.pick.enable`
- {option}`vim.telescope.enable`
- {option}`vim.fzf-lua.enable`
{option}`vim.notes.obsidian.setupOpts.ui.enable` is automatically disabled if `render-markdown.nvim` or `markview.nvim` are enabled.
[vim-markdown]: https://github.com/preservim/vim-markdown?tab=readme-ov-file#options
'';
};
completion = {
nvim_cmp = mkOption {
# If using nvim-cmp, otherwise set to false
type = bool;
description = "If using nvim-cmp, otherwise set to false";
default = autocompleteCfg.nvim-cmp.enable || autocompleteCfg.blink-cmp.enable;
};
};
};
setupOpts = mkPluginSetupOption "obsidian.nvim" {};
};
};
}

View file

@ -21,7 +21,7 @@ in {
pluginRC.orgmode = entryAnywhere ''
-- Treesitter configuration
require('nvim-treesitter.configs').setup {
require('nvim-treesitter.config').setup {
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
-- highlighting will fallback to default Vim syntax highlighting

View file

@ -17,9 +17,20 @@ in {
vim = {
lazy.plugins.toggleterm-nvim = {
package = "toggleterm-nvim";
cmd = ["ToggleTerm" "ToggleTermSendCurrentLine" "ToggleTermSendVisualLines" "ToggleTermSendVisualSelection" "ToggleTermSetName" "ToggleTermToggleAll"];
cmd = [
"ToggleTerm"
"ToggleTermSendCurrentLine"
"ToggleTermSendVisualLines"
"ToggleTermSendVisualSelection"
"ToggleTermSetName"
"ToggleTermToggleAll"
];
keys =
[(mkKeymap "n" cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" {desc = "Toggle terminal";})]
[
(mkKeymap ["n" "t"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" {
desc = "Toggle terminal";
})
]
++ optional cfg.lazygit.enable {
key = cfg.lazygit.mappings.open;
mode = "n";

View file

@ -1,19 +1,13 @@
{
config,
lib,
options,
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.modules) mkIf;
inherit (lib.lists) optionals;
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryBefore entryAfter;
inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.treesitter;
mappingDefinitions = options.vim.treesitter.mappings;
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in {
config = mkIf cfg.enable {
vim = {
@ -27,68 +21,46 @@ in {
treesitter.grammars = optionals cfg.addDefaultGrammars cfg.defaultGrammars;
maps = {
# HACK: Using mkSetLuaBinding and putting the lua code does not work for some reason: It just selects the whole file.
# This works though, and if it ain't broke, don't fix it.
normal = mkSetBinding mappings.incrementalSelection.init ":lua require('nvim-treesitter.incremental_selection').init_selection()<CR>";
pluginRC.treesitter-autocommands = entryAfter ["basic"] ''
vim.api.nvim_create_augroup("nvf_treesitter", { clear = true })
visualOnly = mkMerge [
(mkSetBinding mappings.incrementalSelection.incrementByNode "<cmd>lua require('nvim-treesitter.incremental_selection').node_incremental()<CR>")
(mkSetBinding mappings.incrementalSelection.incrementByScope "<cmd>lua require('nvim-treesitter.incremental_selection').scope_incremental()<CR>")
(mkSetBinding mappings.incrementalSelection.decrementByNode "<cmd>lua require('nvim-treesitter.incremental_selection').node_decremental()<CR>")
];
};
${lib.optionalString cfg.highlight.enable ''
-- Enable treesitter highlighting for all filetypes
vim.api.nvim_create_autocmd("FileType", {
group = "nvf_treesitter",
pattern = "*",
callback = function()
pcall(vim.treesitter.start)
end,
})
''}
# For some reason treesitter highlighting does not work on start if this is set before syntax on
pluginRC.treesitter-fold = mkIf cfg.fold (entryBefore ["basic"] ''
-- This is required by treesitter-context to handle folds
vim.o.foldmethod = "expr"
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
${lib.optionalString cfg.indent.enable ''
-- Enable treesitter highlighting for all filetypes
vim.api.nvim_create_autocmd("FileType", {
group = "nvf_treesitter",
pattern = "*",
callback = function()
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end,
})
''}
-- This is optional, but is set rather as a sane default.
-- If unset, opened files will be folded by automatically as
-- the files are opened
vim.o.foldenable = false
'');
pluginRC.treesitter = entryAfter ["basic"] ''
require('nvim-treesitter.configs').setup {
-- Disable imperative treesitter options that would attempt to fetch
-- grammars into the read-only Nix store. To add additional grammars here
-- you must use the `config.vim.treesitter.grammars` option.
auto_install = false,
sync_install = false,
ensure_installed = {},
-- Indentation module for Treesitter
indent = {
enable = ${toLuaObject cfg.indent.enable},
disable = ${toLuaObject cfg.indent.disable},
},
-- Highlight module for Treesitter
highlight = {
enable = ${toLuaObject cfg.highlight.enable},
disable = ${toLuaObject cfg.highlight.disable},
additional_vim_regex_highlighting = ${toLuaObject cfg.highlight.additionalVimRegexHighlighting},
},
-- Indentation module for Treesitter
-- Keymaps are set to false here as they are
-- handled by `vim.maps` entries calling lua
-- functions achieving the same functionality.
incremental_selection = {
enable = ${toLuaObject cfg.incrementalSelection.enable},
disable = ${toLuaObject cfg.incrementalSelection.disable},
keymaps = {
init_selection = false,
node_incremental = false,
scope_incremental = false,
node_decremental = false,
},
},
}
${lib.optionalString cfg.fold ''
-- Enable treesitter folding for all filetypes
vim.api.nvim_create_autocmd("FileType", {
group = "nvf_treesitter",
pattern = "*",
callback = function()
vim.wo[0][0].foldmethod = "expr"
vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
-- This is optional, but is set rather as a sane default.
-- If unset, opened files will be folded by automatically as
-- the files are opened
vim.o.foldenable = false
end,
})
''}
'';
};
};

View file

@ -3,21 +3,12 @@
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
inherit (lib.types) listOf package str either bool;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) luaInline;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) listOf package bool;
in {
options.vim.treesitter = {
enable = mkEnableOption "treesitter, also enabled automatically through language options";
mappings.incrementalSelection = {
init = mkMappingOption "Init selection [treesitter]" "gnn";
incrementByNode = mkMappingOption "Increment selection by node [treesitter]" "grn";
incrementByScope = mkMappingOption "Increment selection by scope [treesitter]" "grc";
decrementByNode = mkMappingOption "Decrement selection by node [treesitter]" "grm";
};
fold = mkEnableOption "fold with treesitter";
autotagHtml = mkEnableOption "autoclose and rename html tag";
@ -25,14 +16,14 @@ in {
type = listOf package;
default = [];
example = literalExpression ''
with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [
regex
kdl
];
'';
description = ''
List of treesitter grammars to install. For grammars to be installed properly,
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`.
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.parsers` or `pkgs.vimPlugins.nvim-treesitter.grammarPlugins`.
You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars.
For languages already supported by nvf, you may use
@ -56,7 +47,7 @@ in {
internal = true;
readOnly = true;
type = listOf package;
default = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [c lua vim vimdoc query];
default = with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [c lua vim vimdoc query];
description = ''
A list of treesitter grammars that will be installed by default
if treesitter has been enabled and {option}`vim.treeesitter.addDefaultGrammars`
@ -73,105 +64,7 @@ in {
'';
};
indent = {
enable = mkEnableOption "indentation with treesitter" // {default = true;};
disable = mkOption {
type = either (listOf str) luaInline;
default = [];
example = literalExpression ''["c" "rust"]'';
description = ''
List of treesitter grammars to disable indentation for.
This option can be either a list, in which case it will be
converted to a Lua table containing grammars to disable
indentation for, or a string containing a **lua function**
that will be read as is.
::: {.warning}
A comma will be added at the end of your function, so you
do not need to add it yourself. Doing so will cause in
syntax errors within your Neovim configuration.
:::
'';
};
};
highlight = {
enable = mkEnableOption "highlighting with treesitter" // {default = true;};
disable = mkOption {
type = either (listOf str) luaInline;
default = [];
example = literalMD ''
```lua
-- Disable slow treesitter highlight for large files
function(lang, buf)
local max_filesize = 1000 * 1024 -- 1MB
local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end
```
'';
description = ''
List of treesitter grammars to disable highlighting for.
This option can be either a list, in which case it will be
converted to a Lua table containing grammars to disable
highlighting for, or a string containing a **lua function**
that will be read as is.
::: {.warning}
A comma will be added at the end of your function, so you
do not need to add it yourself. Doing so will cause in
syntax errors within your Neovim configuration.
:::
'';
};
additionalVimRegexHighlighting = mkOption {
type = either bool (listOf str);
default = false;
description = ''
Takes either a boolean or a list of languages.
Setting this to true will run `:h syntax` and tree-sitter at the same time.
You may this to `true` if you depend on 'syntax' being enabled (like for
indentation).
::: {.note}
Using this option may slow down your editor, and you may see some duplicate
highlights.
:::
'';
};
};
incrementalSelection = {
enable = mkEnableOption "incremental selection with treesitter" // {default = true;};
disable = mkOption {
type = either (listOf str) luaInline;
default = [];
example = literalExpression ''["c" "rust" ]'';
description = ''
List of treesitter grammars to disable incremental selection
for.
This option can be either a list, in which case it will be
converted to a Lua table containing grammars to disable
indentation for, or a string containing a **lua function**
that will be read as is.
::: {.warning}
A comma will be added at the end of your function, so you
do not need to add it yourself. Doing so will cause in
syntax errors within your Neovim configuration.
:::
'';
};
};
indent = {enable = mkEnableOption "indentation with treesitter" // {default = true;};};
highlight = {enable = mkEnableOption "highlighting with treesitter" // {default = true;};};
};
}

View file

@ -16,7 +16,7 @@ in {
# set up treesitter-textobjects after Treesitter, whose config we're adding to.
pluginRC.treesitter-textobjects = entryAfter ["treesitter"] ''
require("nvim-treesitter.configs").setup({textobjects = ${toLuaObject cfg.setupOpts}})
require("nvim-treesitter.config").setup({textobjects = ${toLuaObject cfg.setupOpts}})
'';
};
};

View file

@ -12,7 +12,7 @@
cfg = config.vim.ui.noice;
tscfg = config.vim.treesitter;
defaultGrammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [vim regex lua bash markdown];
defaultGrammars = with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [vim regex lua bash markdown];
in {
config = mkIf cfg.enable {
vim = {

View file

@ -1,10 +1,148 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) anything attrsOf listOf enum;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
inherit (lib.generators) mkLuaInline;
in {
options.vim.utility.ccc = {
enable = mkEnableOption "ccc color picker for neovim";
setupOpts = mkPluginSetupOption "ccc.nvim" {
highlighter = mkOption {
type = attrsOf anything;
default = {
auto_enable = true;
max_byte = 2 * 1024 * 1024; # 2mb
lsp = true;
filetypes = mkLuaInline "colorPickerFts";
};
description = ''
Settings for the highlighter. See {command}`:help ccc` for options.
'';
};
pickers = mkOption {
type = listOf luaInline;
default = map mkLuaInline [
"ccc.picker.hex"
"ccc.picker.css_rgb"
"ccc.picker.css_hsl"
"ccc.picker.ansi_escape { meaning1 = \"bold\", }"
];
description = ''
List of formats that can be detected by {command}`:CccPick` to be
activated.
Must be inline lua references to `ccc.picker`, for example
`mkLuaInline "ccc.picker.hex"`. See {command}`:help ccc` for options.
'';
};
alpha_show = mkOption {
type = enum [
"show"
"hide"
"auto"
];
default = "hide";
description = ''
This option determines whether the alpha slider is displayed when the
UI is opened. "show" and "hide" mean as they are. "auto" makes the
slider appear only when the alpha value can be picked up.
'';
};
recognize = mkOption {
type = attrsOf anything;
default = {
output = true;
};
description = ''
Settings for recognizing the color format. See {command}`:help ccc` for options.
'';
};
inputs = mkOption {
type = listOf luaInline;
default = map mkLuaInline ["ccc.input.hsl"];
description = ''
List of color systems to be activated. Must be inline lua references to
`ccc.input`, for example `mkLuaInline "ccc.input.rgb"`. See
{command}`:help ccc` for options.
The toggle input mode action toggles in this order. The first one is
the default used at the first startup. Once activated, it will keep the
previous input mode.
'';
};
outputs = mkOption {
type = listOf luaInline;
default = map mkLuaInline [
"ccc.output.css_hsl"
"ccc.output.css_rgb"
"ccc.output.hex"
];
description = ''
List of output formats to be activated. Must be inline Lua references to
`ccc.output`, for example `mkLuaInline "ccc.output.rgb"`. See
{command}`:help ccc` for options.
The toggle output mode action toggles in this order. The first one is
the default used at the first startup. Once activated, it will keep the
previous output mode.
'';
};
convert = mkOption {
type = listOf (listOf luaInline);
default = map (map mkLuaInline) [
[
"ccc.picker.hex"
"ccc.output.css_hsl"
]
[
"ccc.picker.css_rgb"
"ccc.output.css_hsl"
]
[
"ccc.picker.css_hsl"
"ccc.output.hex"
]
];
description = ''
Specify the correspondence between picker and output. Must be a list of
two-element lists defining picker/output pairs as inline Lua references,
for example:
```nix
map (map mkLuaInline) [
["ccc.picker.hex", "ccc.output.css_rgb"]
["ccc.picker.css_rgb", "ccc.output.hex"]
];
```
See {command}`:help ccc` for options.
'';
};
mappings = mkOption {
type = attrsOf luaInline;
default = {
"q" = mkLuaInline "ccc.mapping.quit";
"L" = mkLuaInline "ccc.mapping.increase10";
"H" = mkLuaInline "ccc.mapping.decrease10";
};
description = ''
The mappings are set in the UI of ccc. The table where lhs is key and
rhs is value. To disable all default mappings, use
{option}`vim.utility.ccc.setupOpts.disable_default_mappings`. To
disable only some of the default mappings, set `ccc.mapping.none`.
'';
};
};
mappings = {
quit = mkMappingOption "Cancel and close the UI without replace or insert" "<Esc>";
increase10 = mkMappingOption "Increase the value times delta of the slider" "<L>";

View file

@ -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})
'';
};
}

View file

@ -46,6 +46,21 @@
# Disable failing require check hook checks
doCheck = false;
};
# Checkhealth fails to get the plugin's commit and therefore to
# show the rest of the useful diagnostics if not built like this.
obsidian-nvim = pkgs.vimUtils.buildVimPlugin {
# If set to `"obsidian-nvim"`, this breaks like `buildPlug` and `noBuildPlug`.
name = "obsidian.nvim";
src = getPin "obsidian-nvim";
nvimSkipModules = [
"minimal"
# require picker plugins
"obsidian.picker._telescope"
"obsidian.picker._snacks"
"obsidian.picker._fzf"
"obsidian.picker._mini"
];
};
# Get plugins built from source from self.packages
# If adding a new plugin to be built from source, it must also be inherited