blob: 465f24f022f6ddb82e340f111d75f1537f091837 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
{pkgs, ...}: let
numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"];
mkNumberedCommand = {
command_template,
prefix,
number,
desc_template,
}: {
key = "${prefix}${number}";
action.__raw = ''
function()
${command_template number}
end
'';
options.desc = "${desc_template number}";
};
mkGotoTerminalCommand = number: let
desc_template = number: "Goto terminal number ${number}";
command_template = number: ''require("harpoon.term").gotoTerminal(${number})'';
prefix = "gt";
in
mkNumberedCommand {inherit desc_template command_template prefix number;};
mkGotoFileCommand = number: let
desc_template = number: "Goto Buffer number ${number}";
command_template = number: ''require("harpoon.ui").nav_file(${number})'';
prefix = "gf";
in
mkNumberedCommand {inherit desc_template command_template prefix number;};
gotoTerminalMappings = builtins.map mkGotoTerminalCommand numbers;
gotoFileMappings = builtins.map mkGotoFileCommand numbers;
in {
programs.nixvim = {
plugins.harpoon = {
enable = true;
package = pkgs.vimPlugins.harpoon;
enableTelescope = true;
# menu.width = "vim.api.nvim_win_get_width(0) - 4"; # TODO: integrate that
keymaps = {
tmuxGotoTerminal = null; # TODO:
};
};
keymaps =
[
{
key = "-";
action.__raw = ''
function()
require("harpoon.ui").nav_next()
end
'';
options.desc = "go to the next marked file";
}
{
key = "_";
action.__raw = ''
function()
require("harpoon.ui").nav_prev()
end
'';
options.desc = "go to the previous marked file";
}
{
key = "<leader><leader>";
action.__raw = ''
function()
require("harpoon.mark").add_file()
end
'';
options.desc = "add a mark to the open file in harpoon.";
}
{
key = "gqc";
action.__raw = ''
function()
require("harpoon.cmd-ui").toggle_quick_menu()
end
'';
options.desc = "toggle the harpoon command quick menu to see all commands.";
}
{
key = "<leader>q";
action.__raw = ''
function()
require("harpoon.ui").toggle_quick_menu()
end
'';
options.desc = "toggle the harpoon normal quick menu to see all marks.";
}
]
++ gotoFileMappings
++ gotoTerminalMappings;
};
}
|