plugins/telescope: add keymaps and keymapsSilent options (#179)

This commit is contained in:
Gaétan Lepage 2023-02-23 10:14:10 +01:00 committed by GitHub
parent 8f266e86ef
commit f6c00a8ea5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = {
"<leader>fg" = "live_grep";
"<C-p>" = "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 =
{