nixos/pkgsets/nvim/harpoon.nix

88 lines
2 KiB
Nix

{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::harpoon" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
dir = vPlug: vPlug.harpoon2;
lazy = true;
keys =
[
{
bind = "<leader>ha";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():add()
end
'';
}
{
bind = "<leader>he";
cmdIsFunction = true;
cmd = # lua
''
function()
local harpoon = require("harpoon")
harpoon.ui:toggle_quick_menu(harpoon:list())
end
'';
}
{
bind = "<C-h>";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(1)
end
'';
}
{
bind = "<C-j>";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(2)
end
'';
}
{
bind = "<C-k>";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(3)
end
'';
}
{
bind = "<C-l>";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(4)
end
'';
}
]
++ (map (num: {
bind = "<leader>h${toString (lib.mod num 10)}";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(${toString num})
end
'';
}) (lib.range 1 10));
}
];
}