[mini.visits] Visits tweaked to operate like grapple or harpoon #1158
abeldekat
started this conversation in
Show and tell
Replies: 2 comments 3 replies
-
That's a nice project to craft what best suits your workflow! At this level of complexity and incompatibility, though, maybe it would be better to write something own from scratch instead of forcing and hacking 'mini.visits'? |
Beta Was this translation helpful? Give feedback.
3 replies
-
I refactored the code into a separate internal plugin: ak.mini.visits_harpooned and ak.mini.visits_harpooned_line |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From grapple.nvim to mini.visits
mini_visits_like_grapple_and_harpoon.mp4
I always thought it must be possible to use mini.visits in a similar way as
grapple
orharpoon
However, two previous implementation attempts failed.
In its default setup,
visits
has the following incompatible traits:Relevant line in help regarding simultaneous projects:
Relevant line in help regarding harpoon:
It took me a while to find the obvious solution: Store one index per project.
Having this basic approach, the rest of the implementation followed naturally.
EDIT 20240822: The latest version can be found here
EDIT 20240826:
I refactored the code into a separate internal plugin: ak.mini.visits_harpooned and ak.mini.visits_harpooned_line
The setup
This setup constrains the behaviour of
mini.visits
. I don't think it's possible to have the default experience alongside the functionality described in this post.That said, I personally don't need default
mini.visits
functionality, as my workflow leans heavily ongrapple/harpoon
features, in combination withmini.pick
,oil
andtmux
.Core version
EDIT 20240819: Added a standalone version without statusline and extra maintenance options.
core standalone version
The code
All links are permalinks to fragments in my
Neovim
config:https://github.com/abeldekat/nvim_pde
ak.config.editor.mini_visits
Covers the main part of the implementation. Contains 250 lines of code. Minus 100 lines for the "maintain dialogue" part, the resulting 150 lines compare nicely to the corresponding grapple config.
Contains one hack.The hack is needed to change labeled visits in batch mode. By temporarily overriding
os.time
, eachlatest
field in the visit will differ one second with the previous visit.EDIT 20240819: Removed the hack. Not needed when using
MiniVisit.get_index()
. Updated permalink.ak.config.ui.visitsline
Show indicators for visits in the current context/label.
Used in
ak.config.ui.mini_statusline.
Corresponding
grapple
part:ak.config.ui.grappleline
ak.config.editor.mini_pick
A customized picker to show all visits for all labels in the exact order per label.
Each line shows a label-path combination.
Key mapping:
<leader>,
ak.config.editor.mini_pick_labeled
See this discussion
Provides fast labels for all pickers(including
vim.ui.select
) that showvisit
information. Labels are just letters, as opposed tolabels
used in the context ofmini.visit
.Related code
ak.util.labels
Shared code defining the labels to use
ak.util.init
Also label an
oil
bufferak.config.autocmds
Use
q
to close the "maintain" dialogueak.deps.editor
Add package
mini.visits
(mini.deps
code)Beta Was this translation helpful? Give feedback.
All reactions