mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-11 16:05:30 +00:00
plugins/utility/harpoon: added harpoon
Harpoon (branch harpoon2) has been added as a plugin. Set under navigation to allow for more naviation plugins to be added in the future (set telescope under navigation?). Basic options and keybinds are included.
This commit is contained in:
parent
08be38ab06
commit
d126bbdc24
5 changed files with 115 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
./diffview
|
./diffview
|
||||||
./fzf-lua
|
./fzf-lua
|
||||||
./gestures
|
./gestures
|
||||||
|
./harpoon
|
||||||
./icon-picker
|
./icon-picker
|
||||||
./images
|
./images
|
||||||
./leetcode-nvim
|
./leetcode-nvim
|
||||||
|
|
|
||||||
51
modules/plugins/utility/harpoon/config.nix
Normal file
51
modules/plugins/utility/harpoon/config.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
options,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.lists) optionals;
|
||||||
|
inherit (lib.strings) concatStrings;
|
||||||
|
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
|
||||||
|
|
||||||
|
cfg = config.vim.navigation.harpoon;
|
||||||
|
|
||||||
|
keys = cfg.mappings;
|
||||||
|
inherit (options.vim.navigation.harpoon) mappings;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["plenary-nvim"];
|
||||||
|
|
||||||
|
lazy.plugins.harpoon = {
|
||||||
|
package = "harpoon";
|
||||||
|
setupModule = "harpoon";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
before = ''
|
||||||
|
'';
|
||||||
|
|
||||||
|
after = ''
|
||||||
|
local harpoon = require("harpoon")
|
||||||
|
harpoon.setup({})
|
||||||
|
'';
|
||||||
|
|
||||||
|
cmd = ["Harpoon"];
|
||||||
|
|
||||||
|
keys = [
|
||||||
|
(mkKeymap "n" keys.markFile "<Cmd>lua require('harpoon'):list():add()<CR>" {desc = mappings.markFile.description;})
|
||||||
|
(mkKeymap "n" keys.listMarks "<Cmd>lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())<CR>" {desc = mappings.listMarks.description;})
|
||||||
|
(mkKeymap "n" keys.file1 "<Cmd>lua require('harpoon'):list():select(1)<CR>" {desc = mappings.file1.description;})
|
||||||
|
(mkKeymap "n" keys.file2 "<Cmd>lua require('harpoon'):list():select(2)<CR>" {desc = mappings.file2.description;})
|
||||||
|
(mkKeymap "n" keys.file3 "<Cmd>lua require('harpoon'):list():select(3)<CR>" {desc = mappings.file3.description;})
|
||||||
|
(mkKeymap "n" keys.file4 "<Cmd>lua require('harpoon'):list():select(4)<CR>" {desc = mappings.file4.description;})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
binds.whichKey.register = pushDownDefault {
|
||||||
|
"<leader>a" = "Harpoon Mark";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/utility/harpoon/default.nix
Normal file
6
modules/plugins/utility/harpoon/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
_: {
|
||||||
|
imports = [
|
||||||
|
./harpoon.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
45
modules/plugins/utility/harpoon/harpoon.nix
Normal file
45
modules/plugins/utility/harpoon/harpoon.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) bool;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
setupOptions = {
|
||||||
|
defaults = {
|
||||||
|
save_on_toggle = mkOption {
|
||||||
|
description = "any time the ui menu is closed then we will save the state back to the backing list, not to the fs";
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
sync_on_ui_close = mkOption {
|
||||||
|
description = "any time the ui menu is closed then the state of the list will be sync'd back to the fs";
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
key = mkOption {
|
||||||
|
description = "how the out list key is looked up. This can be useful when using worktrees and using git remote instead of file path";
|
||||||
|
type = luaInline;
|
||||||
|
default = mkLuaInline ''
|
||||||
|
function()
|
||||||
|
return vim.loop.cwd()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.navigation.harpoon = {
|
||||||
|
mappings = {
|
||||||
|
markFile = mkMappingOption "Mark file [Harpoon]" "<leader>a";
|
||||||
|
listMarks = mkMappingOption "List marked files [Harpoon]" "<C-e>";
|
||||||
|
file1 = mkMappingOption "Go to marked file 1 [Harpoon]" "<C-j>";
|
||||||
|
file2 = mkMappingOption "Go to marked file 2 [Harpoon]" "<C-k>";
|
||||||
|
file3 = mkMappingOption "Go to marked file 3 [Harpoon]" "<C-l>";
|
||||||
|
file4 = mkMappingOption "Go to marked file 4 [Harpoon]" "<C-;>";
|
||||||
|
};
|
||||||
|
|
||||||
|
enable = mkEnableOption "Harpoon: quick bookmarks on keybinds";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "Harpoon" setupOptions;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -471,6 +471,18 @@
|
||||||
"url": "https://github.com/ellisonleao/gruvbox.nvim/archive/089b60e92aa0a1c6fa76ff527837cd35b6f5ac81.tar.gz",
|
"url": "https://github.com/ellisonleao/gruvbox.nvim/archive/089b60e92aa0a1c6fa76ff527837cd35b6f5ac81.tar.gz",
|
||||||
"hash": "0mr8q2xi4s2anibll8lhxax7q1akyg687bp5r58gckkhi04064q4"
|
"hash": "0mr8q2xi4s2anibll8lhxax7q1akyg687bp5r58gckkhi04064q4"
|
||||||
},
|
},
|
||||||
|
"harpoon": {
|
||||||
|
"type": "Git",
|
||||||
|
"repository": {
|
||||||
|
"type": "GitHub",
|
||||||
|
"owner": "ThePrimeagen",
|
||||||
|
"repo": "harpoon"
|
||||||
|
},
|
||||||
|
"branch": "harpoon2",
|
||||||
|
"revision": "ed1f853847ffd04b2b61c314865665e1dadf22c7",
|
||||||
|
"url": "https://github.com/ThePrimeagen/harpoon/archive/ed1f853847ffd04b2b61c314865665e1dadf22c7.tar.gz",
|
||||||
|
"hash": "1dcpdlna2lff9dlsh6i4v16qmn5r9279wdvn0ry3xg4abqwnzc9g"
|
||||||
|
},
|
||||||
"haskell-tools-nvim": {
|
"haskell-tools-nvim": {
|
||||||
"type": "Git",
|
"type": "Git",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue