From 40b3ece389c89512d2f21f765dc589371f469c6f Mon Sep 17 00:00:00 2001 From: Builditluc <37375448+Builditluc@users.noreply.github.com> Date: Thu, 23 Dec 2021 21:51:56 +0100 Subject: [PATCH] telescope-fzf-native: init plugin --- plugins/telescope/default.nix | 1 + plugins/telescope/fzf-native.nix | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 plugins/telescope/fzf-native.nix diff --git a/plugins/telescope/default.nix b/plugins/telescope/default.nix index 6bf10b8e..cbf06c91 100644 --- a/plugins/telescope/default.nix +++ b/plugins/telescope/default.nix @@ -7,6 +7,7 @@ in { imports = [ ./frecency.nix + ./fzf-native.nix ]; # TODO:add support for aditional filetypes. This requires autocommands! diff --git a/plugins/telescope/fzf-native.nix b/plugins/telescope/fzf-native.nix new file mode 100644 index 00000000..7657d0c6 --- /dev/null +++ b/plugins/telescope/fzf-native.nix @@ -0,0 +1,44 @@ +{ pkgs, config, lib, ... }: +with lib; +let + cfg = config.programs.nixvim.plugins.telescope.extensions.fzf-native; +in +{ + options.programs.nixvim.plugins.telescope.extensions.fzf-native = { + enable = mkEnableOption "Enable fzf-native"; + + fuzzy = mkOption { + type = types.nullOr types.bool; + description = "Whether to fuzzy search. False will do exact matching"; + default = null; + }; + overrideGenericSorter = mkOption { + type = types.nullOr types.bool; + description = "Override the generice sorter"; + default = null; + }; + overrideFileSorter = mkOption { + type = types.nullOr types.bool; + description = "Override the file sorter"; + default = null; + }; + caseMode = mkOption { + type = types.nullOr (types.enum [ "smart_case" "ignore_case" "respect_case" ]); + default = null; + }; + }; + + config = let + configuration = { + fuzzy = cfg.fuzzy; + override_generic_sorter = cfg.overrideGenericSorter; + override_file_sorter = cfg.overrideFileSorter; + case_mode = cfg.caseMode; + }; + in mkIf cfg.enable { + programs.nixvim.extraPlugins = [ pkgs.vimPlugins.telescope-fzf-native-nvim ]; + + programs.nixvim.plugins.telescope.enabledExtensions = [ "fzf" ]; + programs.nixvim.plugins.telescope.extensionConfig."fzf" = configuration; + }; +}