about summary refs log tree commit diff stats
path: root/modules/by-name/nv/nvim/plgs/harpoon/default.nix
blob: c85c7c80ffc479e4d5426bff4cb4243df4e5b086 (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
45
46
47
48
49
50
51
52
53
# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
  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."
        ];
      };
  };
}