Small-sized plugin that makes it easy to mark and retrieve your files in a project. Inspired by harpoon, but smaller, so instead of harpooning the files we hook them so we can reel them.
Hook the file in the current buffer with
require('fish-files').add_hook()Navigate away and return to the file exactly where you left off with
<prefix>1 without having to nagivate the jump-list with <C-O>, where
<prefix> is set up in the Configuration below. Keep
hooking files and nagivate to them with <prefix>N where N is given in
the chronological order that the file was hooked. Alternatively, open a picker
with
require('fish-files').manage_hooks()- Neovim > 0.10.0 (probably)
- which-key is not needed but it is recommended.
Install it like any other plugin. For example, if using LazyVim as your
package manager:
{
'AndresYague/fish-files.nvim',
opts = {},
}It can also be initialized through a setup call:
require('fish-files').setup(opts)The default options are
opts = {
prefix = '<leader>' -- Prefix for file jump, <prefix>N goes to the Nth marked file
}These example keymaps set-up the full api
vim.keymap.set(
'n',
'<leader>ja',
require('fish-files').add_hook,
{ desc = 'Hook this file' }
)
vim.keymap.set(
'n',
'<leader>jd',
require('fish-files').remove_hook,
{ desc = 'Unhook this file' }
)
vim.keymap.set(
'n',
'<leader>jm',
require('fish-files').manage_hooks,
{ desc = 'Manage hooks' }
)
vim.keymap.set(
'n',
'<leader>jr',
require('fish-files').unhook_all_files,
{ desc = 'Unhook all files' }
)The manage_hooks function opens a buffer/picker on a floating window so
that it can be modified by the user. Pressing <CR> on a file name closes
the window and opens the file to edit, while saving and exiting (with :wq,
:x or ZZ) propagates the changes made in the buffer to fish-files. That
is, deleting or re-ordering the file names will remove them from the hooks or
change the keybind to access them.
This plugin is inspired by harpoon