mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-03 13:54:29 +02:00
plugins/harpoon: allow to enable the telescope extension (#624)
This commit is contained in:
parent
b5849e2407
commit
d560fc6183
2 changed files with 35 additions and 2 deletions
|
@ -27,6 +27,8 @@ in {
|
||||||
|
|
||||||
package = helpers.mkPackageOption "harpoon" pkgs.vimPlugins.harpoon;
|
package = helpers.mkPackageOption "harpoon" pkgs.vimPlugins.harpoon;
|
||||||
|
|
||||||
|
enableTelescope = mkEnableOption "Enable telescope integration";
|
||||||
|
|
||||||
keymapsSilent = mkOption {
|
keymapsSilent = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Whether harpoon keymaps should be silent.";
|
description = "Whether harpoon keymaps should be silent.";
|
||||||
|
@ -198,10 +200,24 @@ in {
|
||||||
// cfg.extraOptions;
|
// cfg.extraOptions;
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
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];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = let
|
||||||
|
telescopeCfg = ''require("telescope").load_extension("harpoon")'';
|
||||||
|
in ''
|
||||||
require('harpoon').setup(${helpers.toLuaObject setupOptions})
|
require('harpoon').setup(${helpers.toLuaObject setupOptions})
|
||||||
|
${
|
||||||
|
if cfg.enableTelescope
|
||||||
|
then telescopeCfg
|
||||||
|
else ""
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
keymaps = let
|
keymaps = let
|
||||||
|
|
|
@ -7,14 +7,19 @@
|
||||||
plugins.harpoon.enable = true;
|
plugins.harpoon.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
example = {
|
telescopeEnabled = {
|
||||||
# Harpoon expects to access `~/.local/share/nvim/harpoon.json` which is not available in the
|
# Harpoon expects to access `~/.local/share/nvim/harpoon.json` which is not available in the
|
||||||
# test environment
|
# test environment
|
||||||
tests.dontRun = true;
|
tests.dontRun = true;
|
||||||
|
|
||||||
|
plugins.telescope = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
plugins.harpoon = {
|
plugins.harpoon = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
enableTelescope = true;
|
||||||
keymapsSilent = true;
|
keymapsSilent = true;
|
||||||
keymaps = {
|
keymaps = {
|
||||||
addFile = "<leader>a";
|
addFile = "<leader>a";
|
||||||
|
@ -59,4 +64,16 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
telescopeDisabled = {
|
||||||
|
# Harpoon expects to access `~/.local/share/nvim/harpoon.json` which is not available in the
|
||||||
|
# test environment
|
||||||
|
tests.dontRun = true;
|
||||||
|
|
||||||
|
plugins.harpoon = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
enableTelescope = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue