[mini.pick] Augment Pick buffers
with hotkeys
#1096
Replies: 2 comments 3 replies
-
That's a nice idea! To be perfectly honest, I'd say that code look a bit too complex for what it eventually achieves. I especially wouldn't recommend the My mind immediately went in the direction of making a more general
|
Beta Was this translation helpful? Give feedback.
-
Good work on this, I do think a hybrid would be interesting to investigate although i personally never really exceed 20 buffers |
Beta Was this translation helpful? Give feedback.
-
pick_labeled_buffers.mp4
My workflow regarding buffer navigation is centered around grapple.nvim. I do use
Pick buffers
often. Usually, itsquery
contains more than one character, followed byenter
. It would be nice to only type one single "hotkey", inJump2d
fashion.Trying my hand on this requirement has been on my
todo-list
for some time. Recently, plugin snipe.nvim was announced on reddit, reminding me on that "todo".I tried to incorporate
Jump2d
intoPick
in various ways. No cigar unfortunately. The mainPick
window disappears beforeJump2d
has a chance to kick-in.In my opinion, there exists a sweet spot between the amount of opened buffers and the benefit accomplished by using a "hotkey". When the amount of buffers is considerable, the best approach is to narrow down the list using default
Pick buffers
. Pluginsnipe.nvim
uses multiple pages in that situation, a less optimal approach.I took the code from Pick buffers and implemented Pick labeled_buffers
Algorithm:
If the amount of labels can be used to add "hotkeys" to all buffer items, the labels are highlighted. Otherwise, the labels are dimmed, but they are still available for faster navigation.
Pick
operates as usual in that case.The straightforward matching algorithm provided by
Pick
simplified the implementation.Just add a unique letter before the text representing the buffer, and done.
For now, I centered the
pick
window, to more closely resemble the centeredgrapple
window. Also, as the text representing the buffer can be lengthy, I surrounded the text with the labels.The code:
Beta Was this translation helpful? Give feedback.
All reactions