summaryrefslogtreecommitdiffstats
path: root/modules/wrapper/environment/options.nix
blob: fdc070537d50695afa5b7ec69eb49dcc6e2fa4b4 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
{
  pkgs,
  lib,
  ...
}: let
  inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
  inherit (lib.types) package bool str listOf attrsOf;
  inherit (lib.nvim.types) pluginsOpt extraPluginType;
in {
  options.vim = {
    package = mkOption {
      type = package;
      default = pkgs.neovim-unwrapped;
      defaultText = literalExpression "pkgs.neovim-unwrapped";
      description = ''
        The neovim package to use for the wrapper. This
        corresponds to the package that will be wrapped
        with your plugins and settings.

        ::: {.warning}
        You will need to use an unwrapped package for this
        option to work as intended. Using an already wrapped
        package here may yield undesirable results.
        :::
      '';
    };

    viAlias = mkOption {
      type = bool;
      default = true;
      example = false;
      description = "Enable the `vi` alias for `nvim`";
    };

    vimAlias = mkOption {
      type = bool;
      default = true;
      example = false;
      description = "Enable the `vim` alias for `nvim`";
    };

    startPlugins = pluginsOpt {
      default = ["plenary-nvim"];
      example = literalExpression "[pkgs.vimPlugins.telescope-nvim]";
      description = ''
        List of plugins to load on startup. This is used
        internally to add plugins to Neovim's runtime.

        To add additional plugins to your configuration, consider
        using the {option}`vim.extraPlugins`
        option.
      '';
    };

    optPlugins = pluginsOpt {
      default = [];
      example = literalExpression "[pkgs.vimPlugins.vim-ghost]";
      description = ''
        List of plugins to optionally load on startup.

        This option has the same type definition as {option}`vim.startPlugins`
        and plugins in this list are appended to {option}`vim.startPlugins` by
        the wrapper during the build process.

        To avoid overriding packages and dependencies provided by startPlugins, you
        are recommended to use this option or {option}`vim.extraPlugins` option.
      '';
    };

    extraPlugins = mkOption {
      type = attrsOf extraPluginType;
      default = {};
      description = ''
        A list of plugins and their configurations that will be
        set up after builtin plugins.

        This option takes a special type that allows you to order
        your custom plugins using nvf's modified DAG library.
      '';

      example = literalMD ''
        ```nix
        with pkgs.vimPlugins; {
          aerial = {
            package = aerial-nvim;
            setup = "require('aerial').setup {}";
          };

          harpoon = {
            package = harpoon;
            setup = "require('harpoon').setup {}";
            after = ["aerial"]; # place harpoon configuration after aerial
          };
        }
        ```
      '';
    };

    extraPackages = mkOption {
      type = listOf package;
      default = [];
      example = ''[pkgs.fzf pkgs.ripgrep]'';
      description = ''
        List of additional packages to make available to the Neovim
        wrapper.
      '';
    };

    withRuby = mkEnableOption ''
      Ruby support in the Neovim wrapper
    '';

    withNodeJs = mkEnableOption ''
      NodeJS support in the Neovim wrapper
    '';

    luaPackages = mkOption {
      type = listOf str;
      default = [];
      example = ''["magick" "serpent"]'';
      description = "List of Lua packages to install";
    };

    withPython3 = mkEnableOption ''
      Python3 support in the Neovim wrapper
    '';

    python3Packages = mkOption {
      type = listOf str;
      default = [];
      example = ''["pynvim"]'';
      description = "List of python packages to install";
    };

    pluginOverrides = mkOption {
      type = attrsOf package;
      default = {};
      example = literalExpression ''
        {
          lazydev-nvim = pkgs.fetchFromGitHub {
            owner = "folke";
            repo = "lazydev.nvim";
            rev = "";
            hash = "";
          };
        }
      '';
      description = "Attribute set of plugins to override default values";
    };
  };
}