From 37d124e94603f821b56072794c4800ad10252fd7 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 29 Jan 2024 13:47:41 +0100 Subject: [PATCH] plugins/telescope: add ui-select extension --- plugins/telescope/default.nix | 1 + plugins/telescope/ui-select.nix | 34 +++++++++++++++++++ .../plugins/telescope/ui-select.nix | 22 ++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 plugins/telescope/ui-select.nix create mode 100644 tests/test-sources/plugins/telescope/ui-select.nix diff --git a/plugins/telescope/default.nix b/plugins/telescope/default.nix index a6cb6a82..c2609873 100644 --- a/plugins/telescope/default.nix +++ b/plugins/telescope/default.nix @@ -15,6 +15,7 @@ in { ./fzy-native.nix ./media-files.nix ./project-nvim.nix + ./ui-select.nix ./undo.nix ]; diff --git a/plugins/telescope/ui-select.nix b/plugins/telescope/ui-select.nix new file mode 100644 index 00000000..a67fffaa --- /dev/null +++ b/plugins/telescope/ui-select.nix @@ -0,0 +1,34 @@ +{ + lib, + helpers, + config, + pkgs, + ... +}: +with lib; let + cfg = config.plugins.telescope.extensions.ui-select; +in { + options.plugins.telescope.extensions.ui-select = { + enable = mkEnableOption "ui-select extension for telescope"; + + package = helpers.mkPackageOption "telescope extension ui-select" pkgs.vimPlugins.telescope-ui-select-nvim; + + settings = mkOption { + type = with types; attrsOf anything; + default = {}; + example = { + specific_opts.codeactions = false; + }; + description = "Settings for this extension."; + }; + }; + + config = mkIf cfg.enable { + plugins.telescope = { + enabledExtensions = ["ui-select"]; + extensionConfig."ui-select" = cfg.settings; + }; + + extraPlugins = [cfg.package]; + }; +} diff --git a/tests/test-sources/plugins/telescope/ui-select.nix b/tests/test-sources/plugins/telescope/ui-select.nix new file mode 100644 index 00000000..18c4ed33 --- /dev/null +++ b/tests/test-sources/plugins/telescope/ui-select.nix @@ -0,0 +1,22 @@ +{ + empty = { + plugins.telescope = { + enable = true; + extensions.ui-select.enable = true; + }; + }; + + example = { + plugins.telescope = { + enable = true; + + extensions.ui-select = { + enable = true; + + settings = { + specific_opts.codeactions = false; + }; + }; + }; + }; +}