[mini.visits] Visits tweaked to operate like grapple or harpoon #1158
Replies: 3 comments 5 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.
-
|
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.
-
visits_harpooned_and_files.mp4Recently, I replaced It took some effort to integrate I can now use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
grappleorharpoonHowever, two previous implementation attempts failed.
In its default setup,
visitshas 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.visitsfunctionality, as my workflow leans heavily ongrapple/harpoonfeatures, in combination withmini.pick,oilandtmux.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
Neovimconfig:https://github.com/abeldekat/nvim_pdeak.config.editor.mini_visitsCovers 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, eachlatestfield 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.visitslineShow indicators for visits in the current context/label.
Used in
ak.config.ui.mini_statusline.Corresponding
grapplepart:ak.config.ui.grapplelineak.config.editor.mini_pickA 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_labeledSee this discussion
Provides fast labels for all pickers(including
vim.ui.select) that showvisitinformation. Labels are just letters, as opposed tolabelsused in the context ofmini.visit.Related code
ak.util.labelsShared code defining the labels to use
ak.util.initAlso label an
oilbufferak.config.autocmdsUse
qto close the "maintain" dialogueak.deps.editorAdd package
mini.visits(mini.depscode)Beta Was this translation helpful? Give feedback.
All reactions