mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-01-18 11:39:47 +01:00
utility/telescope: concat extension setup sets
This commit is contained in:
parent
6594409a25
commit
5f1302321a
1 changed files with 39 additions and 3 deletions
|
@ -1,12 +1,15 @@
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) int str listOf float bool either enum submodule attrsOf anything package;
|
inherit (lib.types) int str listOf float bool either enum submodule attrsOf anything package;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
|
|
||||||
|
cfg = config.vim.telescope;
|
||||||
setupOptions = {
|
setupOptions = {
|
||||||
defaults = {
|
defaults = {
|
||||||
vimgrep_arguments = mkOption {
|
vimgrep_arguments = mkOption {
|
||||||
|
@ -33,7 +36,7 @@
|
||||||
type = either (listOf str) luaInline;
|
type = either (listOf str) luaInline;
|
||||||
default = ["${pkgs.fd}/bin/fd"];
|
default = ["${pkgs.fd}/bin/fd"];
|
||||||
description = ''
|
description = ''
|
||||||
Command to use for finding files. If using an executable from `PATH` then you must
|
Command to use for finding files. If using an executable from {env}`PATH` then you must
|
||||||
make sure that the package is available in [](#opt-vim.extraPackages).
|
make sure that the package is available in [](#opt-vim.extraPackages).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -90,17 +93,20 @@
|
||||||
type = str;
|
type = str;
|
||||||
default = "top";
|
default = "top";
|
||||||
};
|
};
|
||||||
|
|
||||||
preview_width = mkOption {
|
preview_width = mkOption {
|
||||||
description = "";
|
description = "";
|
||||||
type = float;
|
type = float;
|
||||||
default = 0.55;
|
default = 0.55;
|
||||||
};
|
};
|
||||||
|
|
||||||
results_width = mkOption {
|
results_width = mkOption {
|
||||||
description = "";
|
description = "";
|
||||||
type = float;
|
type = float;
|
||||||
default = 0.8;
|
default = 0.8;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
vertical = {
|
vertical = {
|
||||||
mirror = mkOption {
|
mirror = mkOption {
|
||||||
description = "";
|
description = "";
|
||||||
|
@ -108,16 +114,19 @@
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
width = mkOption {
|
width = mkOption {
|
||||||
description = "";
|
description = "";
|
||||||
type = float;
|
type = float;
|
||||||
default = 0.8;
|
default = 0.8;
|
||||||
};
|
};
|
||||||
|
|
||||||
height = mkOption {
|
height = mkOption {
|
||||||
description = "";
|
description = "";
|
||||||
type = float;
|
type = float;
|
||||||
default = 0.8;
|
default = 0.8;
|
||||||
};
|
};
|
||||||
|
|
||||||
preview_cutoff = mkOption {
|
preview_cutoff = mkOption {
|
||||||
description = "";
|
description = "";
|
||||||
type = int;
|
type = int;
|
||||||
|
@ -162,6 +171,12 @@
|
||||||
default = 0;
|
default = 0;
|
||||||
description = "pseudo-transparency of keymap hints floating window";
|
description = "pseudo-transparency of keymap hints floating window";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extensions = mkOption {
|
||||||
|
type = attrsOf anything;
|
||||||
|
default = builtins.foldl' (acc: x: acc // (x.setup or {})) {} cfg.extensions;
|
||||||
|
description = "Attribute set containing per-extension settings for Telescope";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -177,6 +192,13 @@
|
||||||
default = [];
|
default = [];
|
||||||
description = "Package or packages providing the Telescope extension to be loaded.";
|
description = "Package or packages providing the Telescope extension to be loaded.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setup = mkOption {
|
||||||
|
type = attrsOf anything;
|
||||||
|
default = {};
|
||||||
|
example = {fzf = {fuzzy = true;};};
|
||||||
|
description = "Named attribute set to be inserted into Telescope's extensions table.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
@ -210,10 +232,24 @@ in {
|
||||||
enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility";
|
enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility";
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "Telescope" setupOptions;
|
setupOpts = mkPluginSetupOption "Telescope" setupOptions;
|
||||||
|
|
||||||
extensions = mkOption {
|
extensions = mkOption {
|
||||||
type = listOf (attrsOf (submodule extensionOpts));
|
type = listOf (attrsOf (submodule extensionOpts));
|
||||||
default = [];
|
default = [];
|
||||||
description = "TODO";
|
example = literalExpression ''
|
||||||
|
[
|
||||||
|
{
|
||||||
|
name = "fzf";
|
||||||
|
packages = [pkgs.vimPlugins.telescope-fzf-native-nvim];
|
||||||
|
setup = {fzf = {fuzzy = true;};};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Individual extension configurations containing **name**, **packages** and **setup**
|
||||||
|
fields to resolve dependencies, handle `load_extension` calls and add the `setup`
|
||||||
|
table into the `extensions` portion of Telescope's setup table.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue