|
1 | 1 | { |
| 2 | + config, |
2 | 3 | pkgs, |
3 | 4 | lib, |
4 | 5 | ... |
5 | 6 | }: let |
6 | | - inherit (lib.options) mkEnableOption mkOption; |
| 7 | + inherit (lib.options) mkOption mkEnableOption literalExpression; |
7 | 8 | inherit (lib.types) int str listOf float bool either enum submodule attrsOf anything package; |
8 | 9 | inherit (lib.nvim.binds) mkMappingOption; |
9 | 10 | inherit (lib.nvim.types) mkPluginSetupOption luaInline; |
| 11 | + |
| 12 | + cfg = config.telescope; |
10 | 13 | setupOptions = { |
11 | 14 | defaults = { |
12 | 15 | vimgrep_arguments = mkOption { |
|
33 | 36 | type = either (listOf str) luaInline; |
34 | 37 | default = ["${pkgs.fd}/bin/fd"]; |
35 | 38 | description = '' |
36 | | - Command to use for finding files. If using an executable from `PATH` then you must |
| 39 | + Command to use for finding files. If using an executable from {env}`PATH` then you must |
37 | 40 | make sure that the package is available in [](#opt-vim.extraPackages). |
38 | 41 | ''; |
39 | 42 | }; |
|
90 | 93 | type = str; |
91 | 94 | default = "top"; |
92 | 95 | }; |
| 96 | + |
93 | 97 | preview_width = mkOption { |
94 | 98 | description = ""; |
95 | 99 | type = float; |
96 | 100 | default = 0.55; |
97 | 101 | }; |
| 102 | + |
98 | 103 | results_width = mkOption { |
99 | 104 | description = ""; |
100 | 105 | type = float; |
101 | 106 | default = 0.8; |
102 | 107 | }; |
103 | 108 | }; |
| 109 | + |
104 | 110 | vertical = { |
105 | 111 | mirror = mkOption { |
106 | 112 | description = ""; |
107 | 113 | type = bool; |
108 | 114 | default = false; |
109 | 115 | }; |
110 | 116 | }; |
| 117 | + |
111 | 118 | width = mkOption { |
112 | 119 | description = ""; |
113 | 120 | type = float; |
114 | 121 | default = 0.8; |
115 | 122 | }; |
| 123 | + |
116 | 124 | height = mkOption { |
117 | 125 | description = ""; |
118 | 126 | type = float; |
119 | 127 | default = 0.8; |
120 | 128 | }; |
| 129 | + |
121 | 130 | preview_cutoff = mkOption { |
122 | 131 | description = ""; |
123 | 132 | type = int; |
|
162 | 171 | default = 0; |
163 | 172 | description = "pseudo-transparency of keymap hints floating window"; |
164 | 173 | }; |
| 174 | + |
| 175 | + extensions = mkOption { |
| 176 | + type = attrsOf anything; |
| 177 | + default = builtins.foldl' (acc: x: acc // (x.setup or {})) {} cfg.extensions; |
| 178 | + description = "Attribute set containing per-extension settings for Telescope"; |
| 179 | + }; |
165 | 180 | }; |
166 | 181 | }; |
167 | 182 |
|
|
177 | 192 | default = []; |
178 | 193 | description = "Package or packages providing the Telescope extension to be loaded."; |
179 | 194 | }; |
| 195 | + |
| 196 | + setup = mkOption { |
| 197 | + type = attrsOf anything; |
| 198 | + default = {}; |
| 199 | + example = {fzf = {fuzzy = true;};}; |
| 200 | + description = "Named attribute set to be inserted into Telescope's extensions table."; |
| 201 | + }; |
180 | 202 | }; |
181 | 203 | }; |
182 | 204 | in { |
@@ -210,10 +232,24 @@ in { |
210 | 232 | enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility"; |
211 | 233 |
|
212 | 234 | setupOpts = mkPluginSetupOption "Telescope" setupOptions; |
| 235 | + |
213 | 236 | extensions = mkOption { |
214 | 237 | type = listOf (attrsOf (submodule extensionOpts)); |
215 | 238 | default = []; |
216 | | - description = "TODO"; |
| 239 | + example = literalExpression '' |
| 240 | + [ |
| 241 | + { |
| 242 | + name = "fzf"; |
| 243 | + packages = [pkgs.vimPlugins.telescope-fzf-native-nvim]; |
| 244 | + setup = {fzf = {fuzzy = true;};}; |
| 245 | + } |
| 246 | + ] |
| 247 | + ''; |
| 248 | + description = '' |
| 249 | + Individual extension configurations containing **name**, **packages** and **setup** |
| 250 | + fields to resolve dependencies, handle `load_extension` calls and add the `setup` |
| 251 | + table into the `extensions` portion of Telescope's setup table. |
| 252 | + ''; |
217 | 253 | }; |
218 | 254 | }; |
219 | 255 | } |
0 commit comments