Adding Vim-style marks to the hints feature #58
Replies: 4 comments 2 replies
-
|
I like this idea. |
Beta Was this translation helpful? Give feedback.
-
|
Thia is a cool idea, thank you! I have considered the "hints should be stable" problem briefly before but didn't put as much thought into it as you have :) I'm not quite sure yet whether I'd want marks to be be something like this, or more similar to vim marks, which could also be pretty useful. e.g. if you're frequently switching between a couple tabs or within the same tab, vim-style marks would be quite nice. Regardless, I am on board with adding a feature like this! It might just end up going under a different name / default keymap. I especially like your proposed UX flow for setting and using marks. I'll note that, depending on the website, being resistant to DOM changes could be quite difficult, and impossible to achieve fully. That said, I don't think that's a huge deal - especially if it'd be easy to customise how the elements are matched. Maybe this is crazy, but it might make sense to define a "managed" For what it's worth, you could make hints stable today by calling See glide/src/glide/browser/base/content/plugins/keymaps.mts Lines 44 to 49 in 81e21d0 glide/src/glide/browser/base/content/hinting.mts Lines 185 to 204 in 81e21d0
Additionally, I don't know what the UI looks like but I suspect this will work - try pressing |
Beta Was this translation helpful? Give feedback.
-
|
In my experience, just walking the DOM and assigning in order is enough for most sites to give you predictable hints. Tridactyl's "numeric" hint mode works this way, and you can get the same behavior with this tiny patch: diff --git a/src/glide/browser/base/content/browser-commands.mts b/src/glide/browser/base/content/browser-commands.mts
index 3e8cc60..5e1a70e 100644
--- a/src/glide/browser/base/content/browser-commands.mts
+++ b/src/glide/browser/base/content/browser-commands.mts
@@ -170,7 +170,7 @@ class GlideCommandsClass {
for (let i = 0; i < hints.length; i++) {
const hint = hints[i]!;
- hint.label = labels[i]!;
+ hint.label = (i+1).toString();
const hint_div = DOM.create_element("div", {
className: `glide-reset glide-internal-hint-marker`,diffI'd love for it to be a real feature, but I wasn't sure of the right way to integrate it. One option is to just have a config option for "numeric hints". Allowing a custom function (that could obviously just yield |
Beta Was this translation helpful? Give feedback.
-
|
Leap.nvim's (github) solution to this problem is interesting. Leap's approach (as far as I know)In Leap's "hint" mode:
screenshot of searching `le` with multiple matchesSince there are multiple jump locations for
(source) Issues Applying to Glide
|
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
My biggest issue with the hints menu in extensions like vimium is that the keystrokes necessary to perform an action on a given website are unmemorizable and unpredictable. For me, this can really hamper the usefulness of hints for navigation. Ideally, the workflow would be more similar to switching between vim buffers, where you know that
:b 2will always do exactly the same thing.For example, I use the web client for Google messages, and every time I switch to the browser window in my tiling window manager, I have to press f, parse what the hint for the message text-box is, and type it. If I could count on that keybind being consistent, I could commit it to muscle memory, but it's different for every page, and maybe even from tab to tab.
My thought is that maybe the UX can be improved by taking a page out of the marks feature in vim. The workflow would be as follows:
1. Setting a Mark (Mark Mode)
min normal mode to enter "mark mode."f.2. Using a Mark (Hint Mode)
fto bring up the hints, as they normally would.3. Storing marks across browser sessions
A fingerprint of the marked elements could be stored as a JSON object, containing things like inner text, id attributes, the dom path, etc. I don't work in web dev much, so I'm not sure what best practices are here, but it seems like a solvable problem. For my use case at least, I don't need it to be perfect, just a little resilient to website changes.
4. Files to change
From what I understand, some changes would need to be made to
hinting.mts,hints.mts,keymaps.mts, and a new file namedmarks.mtsor something equivalent.I'm no typescript expert, and I know this is probably not a super urgent or essential feature, but it's one I'm interested in, and would be happy to work on. I just thought I would put it out there, and see if anyone had any thoughts.
Beta Was this translation helpful? Give feedback.
All reactions