about summary refs log tree commit diff stats
path: root/modules/by-name/nv/nvim/plgs/harpoon/default.nix
blob: 3760ce150e92b25501f220de5423f472f591fa5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
  lib,
  config,
  ...
}: let
  cfg = config.soispha.programs.nvim;
in {
  home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable {
    plugins.harpoon.enable = true;

    keymaps =
      lib.mapAttrsToList
      (key: action: {
        mode = "n";
        inherit key;
        action.__raw = builtins.elemAt action 0;
        options.silent = true;
        options.desc = builtins.elemAt action 1;
      })
      {
        # add current file
        "<leader><leader>" = [
          # lua
          ''
            function()
              require("harpoon"):list():add()
            end
          ''
          "Add a mark to the open file in harpoon."
        ];

        # open menu
        "<leader>q" = [
          # lua
          ''
            function()
                require("harpoon").ui:toggle_quick_menu(require("harpoon"):list())
            end
          ''
          "Toggle the harpoon normal quick menu to see all marks."
        ];
      };
  };
}