Skip to content

Commit 45ad224

Browse files
committed
plugins/ccc: lazy load
1 parent af19044 commit 45ad224

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

docs/manual/release-notes/rl-26.12.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
- `typst-preview.nvim`: lazy-load.
102102
- `vim-illuminate`: lazy-load.
103103
- `which-key.nvim`: lazy-load.
104+
- `ccc-nvim`: lazy-load.
104105
- `plugins/git/octo-nvim`: init.
105106

106107
[gmvar](https://github.com/gmvar):

modules/plugins/utility/ccc/config.nix

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,27 @@
44
...
55
}: let
66
inherit (lib.modules) mkIf;
7-
inherit (lib.nvim.dag) entryAnywhere;
8-
inherit (lib.nvim.lua) toLuaObject;
7+
inherit (lib.attrsets) optionalAttrs;
98
cfg = config.vim.utility.ccc;
109
in {
1110
config = mkIf cfg.enable {
12-
vim.startPlugins = ["ccc-nvim"];
13-
14-
vim.pluginRC.ccc = entryAnywhere ''
15-
local ccc = require("ccc")
16-
ccc.setup(${toLuaObject cfg.setupOpts})
17-
'';
11+
vim.lazy.plugins."ccc-nvim" =
12+
{
13+
package = "ccc-nvim";
14+
setupModule = "ccc";
15+
beforeSetup = ''local ccc = require("ccc")'';
16+
# Omitted CccHighliterDisable since it would only ever be called as the first command
17+
# if auto_enable was enabled, which would make the cmd option useless anyways
18+
cmd = ["CccPick" "CccConvert" "CccHighlighterEnable" "CccHighlighterToggle"];
19+
inherit (cfg) setupOpts;
20+
}
21+
// optionalAttrs (cfg.setupOpts.highlighter.auto_enable or false) {
22+
event = [
23+
{
24+
event = "User";
25+
pattern = "LazyFile";
26+
}
27+
];
28+
};
1829
};
1930
}

0 commit comments

Comments
 (0)