summaryrefslogtreecommitdiffstats
path: root/modules/plugins/utility/new-file-template/new-file-template.nix
blob: ce76182f1d5341ce4bdf2d68828d00720dacaa30 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{lib, ...}: let
  inherit (lib.options) mkOption mkEnableOption;
  inherit (lib.types) attrsOf bool listOf str;
  inherit (lib.nvim.types) mkPluginSetupOption;
in {
  options.vim.utility.new-file-template = {
    enable = mkEnableOption ''
      new-file-template.nvim: Automatically insert a template on new files in neovim.
      ::: {.note}
      For custom templates add a directory containing `lua/templates/*.lua`
      to `vim.additionalRuntimePaths`.
      :::
      [custom-template-docs]: https://github.com/otavioschwanck/new-file-template.nvim?tab=readme-ov-file#creating-new-templates
      More documentation on the templates available at [custom-template-docs]
    '';

    setupOpts = mkPluginSetupOption "nvim-file-template.nvim" {
      disableInsert = mkOption {
        type = bool;
        default = false;
        description = "Enter insert mode after inserting the template";
      };

      disableAutocmd = mkOption {
        type = bool;
        default = false;
        description = "Disable the autocmd that creates the template";
      };

      disableFiletype = mkOption {
        type = listOf str;
        default = [];
        description = "Disable default templates for specific filetypes";
      };

      disableSpecific = mkOption {
        type = attrsOf (listOf str);
        default = {};
        description = "Disable specific regexp for the default templates.";
        example = "{ ruby = [\".*\"]; }";
      };

      suffixAsFiletype = mkOption {
        type = bool;
        default = false;
        description = "Use suffix of filename rather than `vim.bo.filetype` as filetype";
      };
    };
  };
}