plugins/harpoon: allow to enable the telescope extension (#624)

This commit is contained in:
Haseeb Majid 2023-10-18 17:20:03 +01:00 committed by GitHub
parent b5849e2407
commit d560fc6183
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 2 deletions

View file

@ -27,6 +27,8 @@ in {
package = helpers.mkPackageOption "harpoon" pkgs.vimPlugins.harpoon;
enableTelescope = mkEnableOption "Enable telescope integration";
keymapsSilent = mkOption {
type = types.bool;
description = "Whether harpoon keymaps should be silent.";
@ -198,10 +200,24 @@ in {
// cfg.extraOptions;
in
mkIf cfg.enable {
assertions = [
{
assertion = config.plugins.telescope.enable -> cfg.enableTelescope;
message = ''Nixvim: The harpoon telescope integration needs telescope to function as intended'';
}
];
extraPlugins = [cfg.package];
extraConfigLua = ''
extraConfigLua = let
telescopeCfg = ''require("telescope").load_extension("harpoon")'';
in ''
require('harpoon').setup(${helpers.toLuaObject setupOptions})
${
if cfg.enableTelescope
then telescopeCfg
else ""
}
'';
keymaps = let