From f6c00a8ea5f49378ab5c9dca98345cd59861c95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=A9tan=20Lepage?= <33058747+GaetanLepage@users.noreply.github.com> Date: Thu, 23 Feb 2023 10:14:10 +0100 Subject: [PATCH] plugins/telescope: add keymaps and keymapsSilent options (#179) --- plugins/telescope/default.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugins/telescope/default.nix b/plugins/telescope/default.nix index d4609ca6..f5c94c4a 100644 --- a/plugins/telescope/default.nix +++ b/plugins/telescope/default.nix @@ -23,6 +23,22 @@ in { package = helpers.mkPackageOption "telescope.nvim" pkgs.vimPlugins.telescope-nvim; + keymaps = mkOption { + type = types.attrsOf types.str; + description = "Keymaps for telescope."; + default = {}; + example = { + "fg" = "live_grep"; + "" = "git_files"; + }; + }; + + keymapsSilent = mkOption { + type = types.bool; + description = "Whether telescope keymaps should be silent"; + default = false; + }; + highlightTheme = mkOption { type = types.nullOr types.str; description = "The colorscheme to use for syntax highlighting"; @@ -67,6 +83,15 @@ in { let $BAT_THEME = '${cfg.highlightTheme}' ''; + maps.normal = + mapAttrs + (key: action: { + silent = cfg.keymapsSilent; + action = "require('telescope.builtin').${action}"; + lua = true; + }) + cfg.keymaps; + extraConfigLua = let options = {