aboutsummaryrefslogtreecommitdiffstats
path: root/modules/home/soispha/conf/nvim/plgs/harpoon
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-20 16:06:57 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-20 16:14:24 +0200
commit5156e1aae36a153be98b6832ab3ced7be2b2faee (patch)
tree3f050d3bc567af4c72f87e0925d21c3521436e45 /modules/home/soispha/conf/nvim/plgs/harpoon
parentrefactor(hm/conf/zsh): Remove old zsh-prompt file (diff)
downloadnixos-config-5156e1aae36a153be98b6832ab3ced7be2b2faee.zip
refactor(hm): Rename to `modules/home`
Diffstat (limited to 'modules/home/soispha/conf/nvim/plgs/harpoon')
-rw-r--r--modules/home/soispha/conf/nvim/plgs/harpoon/default.nix100
1 files changed, 100 insertions, 0 deletions
diff --git a/modules/home/soispha/conf/nvim/plgs/harpoon/default.nix b/modules/home/soispha/conf/nvim/plgs/harpoon/default.nix
new file mode 100644
index 00000000..b1421dab
--- /dev/null
+++ b/modules/home/soispha/conf/nvim/plgs/harpoon/default.nix
@@ -0,0 +1,100 @@
+{pkgs, ...}: let
+ numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"];
+ mkNumberedCommand = {
+ command_template,
+ prefix,
+ number,
+ desc_template,
+ }: {
+ key = "${prefix}${number}";
+ action = ''
+ function()
+ ${command_template number}
+ end
+ '';
+ lua = true;
+ 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.vimExtraPlugins.harpoon;
+ enableTelescope = true;
+ # menu.width = "vim.api.nvim_win_get_width(0) - 4"; # TODO: integrate that
+ keymaps = {
+ tmuxGotoTerminal = null; # TODO:
+ };
+ };
+ keymaps =
+ [
+ {
+ key = "-";
+ action = ''
+ function()
+ require("harpoon.ui").nav_next()
+ end
+ '';
+ lua = true;
+ options.desc = "go to the next marked file";
+ }
+ {
+ key = "_";
+ action = ''
+ function()
+ require("harpoon.ui").nav_prev()
+ end
+ '';
+ lua = true;
+ options.desc = "go to the previous marked file";
+ }
+ {
+ key = "<leader><leader>";
+ action = ''
+ function()
+ require("harpoon.mark").add_file()
+ end
+ '';
+ lua = true;
+ options.desc = "add a mark to the open file in harpoon.";
+ }
+ {
+ key = "gqc";
+ action = ''
+ function()
+ require("harpoon.cmd-ui").toggle_quick_menu()
+ end
+ '';
+ lua = true;
+ options.desc = "toggle the harpoon command quick menu to see all commands.";
+ }
+ {
+ key = "<leader>q";
+ action = ''
+ function()
+ require("harpoon.ui").toggle_quick_menu()
+ end
+ '';
+ lua = true;
+ options.desc = "toggle the harpoon normal quick menu to see all marks.";
+ }
+ ]
+ ++ gotoFileMappings
+ ++ gotoTerminalMappings;
+ };
+}