summaryrefslogtreecommitdiffstats
path: root/modules/plugins/utility/ccc/config.nix
blob: 1686740be98c96329489573af44b3ee58f6a3190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  config,
  lib,
  ...
}: let
  inherit (lib.modules) mkIf;
  inherit (lib.attrsets) optionalAttrs;
  cfg = config.vim.utility.ccc;
in {
  config = mkIf cfg.enable {
    vim.lazy.plugins."ccc-nvim" =
      {
        package = "ccc-nvim";
        setupModule = "ccc";
        beforeSetup = ''local ccc = require("ccc")'';
        # Omitted CccHighliterDisable since it would only ever be called as the first command
        # if auto_enable was enabled, which would make the cmd option useless anyways
        cmd = ["CccPick" "CccConvert" "CccHighlighterEnable" "CccHighlighterToggle"];
        inherit (cfg) setupOpts;
      }
      // optionalAttrs (cfg.setupOpts.highlighter.auto_enable or false) {
        event = [
          {
            event = "User";
            pattern = "LazyFile";
          }
        ];
      };
  };
}