mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-04 01:55:11 +02:00
plugins.harpoon: refactor & switch to harpoon2
This commit is contained in:
parent
af76696a92
commit
9f495dda93
3 changed files with 172 additions and 316 deletions
|
@ -1,88 +1,96 @@
|
|||
{
|
||||
empty = {
|
||||
# Harpoon expects to access `~/.local/share/nvim/harpoon.json` which is not available in the
|
||||
# test environment
|
||||
test.runNvim = false;
|
||||
|
||||
plugins.harpoon.enable = true;
|
||||
};
|
||||
|
||||
telescopeEnabled = {
|
||||
# Harpoon expects to access `~/.local/share/nvim/harpoon.json` which is not available in the
|
||||
# test environment
|
||||
test.runNvim = false;
|
||||
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
defaults = {
|
||||
plugins.harpoon = {
|
||||
enable = true;
|
||||
|
||||
enableTelescope = true;
|
||||
keymapsSilent = true;
|
||||
keymaps = {
|
||||
addFile = "<leader>a";
|
||||
navFile = {
|
||||
"1" = "<C-j>";
|
||||
"2" = "<C-k>";
|
||||
"3" = "<C-l>";
|
||||
"4" = "<C-m>";
|
||||
# https://github.com/ThePrimeagen/harpoon/blob/harpoon2/lua/harpoon/config.lua
|
||||
settings = {
|
||||
settings = {
|
||||
save_on_toggle = false;
|
||||
sync_on_ui_close = false;
|
||||
key.__raw = ''
|
||||
function()
|
||||
return vim.loop.cwd()
|
||||
end
|
||||
'';
|
||||
};
|
||||
navNext = "<leader>b";
|
||||
navPrev = "<leader>c";
|
||||
gotoTerminal = {
|
||||
"1" = "J";
|
||||
"2" = "K";
|
||||
"3" = "L";
|
||||
"4" = "M";
|
||||
default = {
|
||||
select_with_nil = false;
|
||||
encode.__raw = ''
|
||||
function(obj)
|
||||
return vim.json.encode(obj)
|
||||
end
|
||||
'';
|
||||
decode.__raw = ''
|
||||
function(str)
|
||||
return vim.json.decode(str)
|
||||
end
|
||||
'';
|
||||
display.__raw = ''
|
||||
function(list_item)
|
||||
return list_item.value
|
||||
end
|
||||
'';
|
||||
# Very long functions omitted for the sake of conciseness
|
||||
};
|
||||
cmdToggleQuickMenu = "<leader>d";
|
||||
tmuxGotoTerminal = {
|
||||
"1" = "<C-1>";
|
||||
"2" = "<C-2>";
|
||||
"{down-of}" = "<leader>g";
|
||||
};
|
||||
};
|
||||
saveOnToggle = false;
|
||||
saveOnChange = true;
|
||||
enterOnSendcmd = false;
|
||||
tmuxAutocloseWindows = false;
|
||||
excludedFiletypes = [ "harpoon" ];
|
||||
markBranch = false;
|
||||
projects = {
|
||||
"$HOME/personal/vim-with-me/server" = {
|
||||
termCommands = [ "./env && npx ts-node src/index.ts" ];
|
||||
};
|
||||
};
|
||||
menu = {
|
||||
width = 60;
|
||||
height = 10;
|
||||
borderChars = [
|
||||
"─"
|
||||
"│"
|
||||
"─"
|
||||
"│"
|
||||
"╭"
|
||||
"╮"
|
||||
"╯"
|
||||
"╰"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
plugins.web-devicons.enable = true;
|
||||
};
|
||||
|
||||
telescopeDisabled = {
|
||||
# Harpoon expects to access `~/.local/share/nvim/harpoon.json` which is not available in the
|
||||
# test environment
|
||||
test.runNvim = false;
|
||||
|
||||
example = {
|
||||
plugins.harpoon = {
|
||||
enable = true;
|
||||
|
||||
enableTelescope = false;
|
||||
settings = {
|
||||
settings = {
|
||||
save_on_toggle = true;
|
||||
sync_on_ui_close = false;
|
||||
};
|
||||
|
||||
# https://github.com/ThePrimeagen/harpoon/tree/harpoon2?tab=readme-ov-file#-api
|
||||
cmd = {
|
||||
add.__raw = ''
|
||||
function(possible_value)
|
||||
-- get the current line idx
|
||||
local idx = vim.fn.line(".")
|
||||
|
||||
-- read the current line
|
||||
local cmd = vim.api.nvim_buf_get_lines(0, idx - 1, idx, false)[1]
|
||||
if cmd == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
return {
|
||||
value = cmd,
|
||||
context = { },
|
||||
}
|
||||
end
|
||||
'';
|
||||
|
||||
select.__raw = ''
|
||||
function(list_item, list, option)
|
||||
vim.cmd(list_item.value)
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
telescopeEnabled = {
|
||||
plugins = {
|
||||
telescope.enable = true;
|
||||
web-devicons.enable = true;
|
||||
|
||||
harpoon = {
|
||||
enable = true;
|
||||
|
||||
enableTelescope = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue