summaryrefslogtreecommitdiffstats
path: root/modules/plugins/mini/indentscope/config.nix
blob: a6fd16d785e0d300d980beed3a8da0d68021ab30 (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
31
32
33
34
35
{
  config,
  lib,
  ...
}: let
  inherit (lib.generators) mkLuaInline;
  inherit (lib.modules) mkIf;
  inherit (lib.nvim.dag) entryAnywhere;
  inherit (lib.nvim.lua) toLuaObject;

  cfg = config.vim.mini.indentscope;
in {
  vim = mkIf cfg.enable {
    autocmds = [
      {
        callback = mkLuaInline ''
          function()
            local ignore_filetypes = ${toLuaObject cfg.setupOpts.ignore_filetypes}
            if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) then
              vim.b.miniindentscope_disable = true
            end
          end
        '';
        desc = "Disable indentscope for certain filetypes";
        event = ["FileType"];
      }
    ];

    startPlugins = ["mini-indentscope"];

    pluginRC.mini-indentscope = entryAnywhere ''
      require("mini.indentscope").setup(${toLuaObject cfg.setupOpts})
    '';
  };
}