akhodakivskiy / VimFx

Vim keyboard shortcuts for Firefox
https://addons.mozilla.org/firefox/addon/vimfx
Other
1.41k stars 174 forks source link

Hints mode based on typing link text (like Vimium, Vimperator and/or Pentadactyl) #340

Closed akhodakivskiy closed 7 years ago

akhodakivskiy commented 10 years ago

Edit by @lydell:

Vimium, Vimperator and Pentadactyl have hint modes mainly based on typing parts of the text of links instead of only using hints (which is the only mode VimFx has).

Do you want something like that?

  1. đź‘Ť this issue
  2. Tell exactly what features you want.
  3. Check out #789.

https://addons.mozilla.org/en-US/firefox/addon/vimfx/reviews/596434/

The reviewer outrun suggested to introduce alternative hints mode with the following workflow:

  1. User enters the hints mode by invoking associated command (let's say af - for alt f)
  2. All the links on the page are highlighted with the markers consisting of numbers exclusively (0-9).
  3. The user can now filter the matching links by typing any text. As she types only the links that contain matching text remain highlighted.
  4. The user enter numeric hint to follow particular link.
  5. The users can press Esc to leave this mode without following any links.
erjoalgo commented 9 years ago

+1 I like this idea. If the text entered uniquely identifies a link, it should be followed right away. Also, hints can be made exclusively upper case, so that more than [0-9]+ links can be used without interfering with the text filtering.

GreenHapi commented 9 years ago

In Windows alt+[(f,e,v,s,b,t,h)] will not work. It activates corresponding to letter Firefox menu. Like alt+f = File menu. Others seem to be ok

lydell commented 9 years ago

This issue has nothing to do with the alt modifier.

GreenHapi commented 9 years ago

(let's say af - for alt f)

I misunderstood this then

frangio commented 9 years ago

This feature is essential as it makes hint mode an absolute pleasure to use. There should be an option to choose between the current way hinting works, and this alternate one. Without modifiers.

joeashcraft commented 9 years ago

This is very similar to how Pentadactyl handled links. f would add a numerical hint to all links, and typing any characters would filter and re-number only those links which include the typed text. Very handy except when you wanted to filter by numerals.

This is the main feature I miss from pentadactyl with vimium or vimfx.

lydell commented 9 years ago

Closing because of too little interest.

e12e commented 8 years ago

Hi, how much work would it be to add a "vimperator"-style hinting mode to vimfx? I ask, because it seems the bar to add this one feature to vimfx is probably easier than porting vimperator to e10s (vimperator is broken in the latest development builds). Ideally, I'd like to have an option to use "vimperator style (numbers, filtered by text input)"-hinting, or VimFX-hinting - set via a config-option. I'd be happy to take a stab at this, if I could be given a hint where to start?

I will say, that while I (personally, not meant as s judgement on what others prefer) find the VimFX-style hinting broken, it did get a lot better with the addition of hold-shift for transparency #220 -- but it should probably be added to the help ("?") screen for new users?

lydell commented 8 years ago

Hi, how much work would it be to add a "vimperator"-style hinting mode to vimfx? I ask, because it seems the bar to add this one feature to vimfx is probably easier than porting vimperator to e10s (vimperator is broken in the latest development builds).

If the only thing you miss from Vimperator is this alternate hinting mode, then, yes, I guess it's easier to add that to VimFx than porting Vimperator e10s. If not, I warn you that VimFx will probably always disappoint you, since the two are different by design (otherwise VimFx wouldn't have been made in the first pace ;) ).

Ideally, I'd like to have an option to use "vimperator style (numbers, filtered by text input)"-hinting, or VimFX-hinting - set via a config-option. I'd be happy to take a stab at this, if I could be given a hint where to start?

If you do take at stab at this, please keep the following in mind:

I will say, that while I (personally, not meant as s judgement on what others prefer) find the VimFX-style hinting broken,

What do you mean by broken? Would you mind elaborating on that?

it did get a lot better with the addition of hold-shift for transparency #220

Please elaborate on this as well! :)

but it should probably be added to the help ("?") screen for new users?

I agree that the use of modifiers in Hints mode is pretty hidden. Do you have a suggestion on how that would look like in the help dialog? Or do you think there's some other way?

e12e commented 8 years ago

Thank you for the pointers, I will have to experiment a bit and see what I find out. I'm guessing the easiest/cleanest might be to write a separate matching command, as the algorithm is a bit different - updating the set of links on text input (eg: going from numbers 1-10 to 1-2, to only one match, which means follow link). So there'd need to be an array of link tuples with link-text and link, and some way to filter on substring match against the array, and a running update of the number-ids of the links.

On your three points: I appreciate that this is different from how VimFX works, and I'm prepared to maintain it myself - if/when I get it working. Your offer to help with questions is much appreciated :-)

As for why I prefer "vimperator-style" hinting: When reading text, switching to hinting mode, I can just "continue where I left off". So if I see a link that says comment, I can just hit f, and type "co1". (Almost) every time I want to follow a link that is labelled "comment". With VimFX style hinting, a hacker news comment link might sort as "ahl", rather than "co". Similarly, a "submit" will almost always be something like "fsub", not randomly "fxkl" on one page (many links ahead of the subit-button, and "fa" on another. So it gives some more consistency to the user experience of browsing without the mouse.

This ties into the shift-hold for transparency - sometimes (this might be due to my zoom level on my high dpi screen) small links (like those awful voting-arrows on hacker news) are obscured by the (relatively) long tags that VimFX hinting generates for sites with 100s of links -- and the shift-hold makes it easier to see which link I want. Again, the ability to filter down to "reply" or "comment" - even if there are many of those makes it easier to prevent following the wrong link (say flagging a comment by mistake). This is also similar for other link-rich sites, like Facebook.

As for help-text, last I checked, shift-hold for transparency wasn't mentioned in the help("?") page at all? Or maybe I just overlooked it?

Finally, regarding the different design of VimFX and vimperator -- I do like many of the differences, keeping the feature set minimal. Perhaps I would ultimately be even more happy with making a friendly fork - but that would mean way too much work on maintaining the fork ;-) I do see a minor benefit in having an easy way to add plugins - for vimperator the only one I use, is a plugin for noscript, giving access to the noscript context menu via the keyboard. I would probably be happy with something similar from the ":" command console that VimFX makes available, but that is a minor issue. The main thing for me is an alternate hinting mode, that fits my work/browse-flow better.

lydell commented 8 years ago

As for why I prefer "vimperator-style" hinting: ...

Thanks such a nice explanation with examples! Seems like there's definitely room for both hinting modes, depending on what people happen to prefer.

This ties into the shift-hold for transparency - ...

Thanks. Glad to hear that people appreciate some of the less common VimFx features!

As for help-text, last I checked, shift-hold for transparency wasn't mentioned in the help("?") page at all? Or maybe I just overlooked it?

You're right, none of the Hints mode modifiers are mentioned there. More generally, the help dialog (currently) only includes regular commands and no "special cases".

I do see a minor benefit in having an easy way to add plugins

I don't know how Vimperator plugins are added, but you do know that VimFx can be quite heavily extended through a config file, right?

a plugin for noscript, giving access to the noscript context menu via the keyboard.

Here's a custom command for NoScript's context menu.

I would probably be happy with something similar from the ":" command console that VimFX makes available, but that is a minor issue.

See the documentation on ex commands.

lydell commented 8 years ago

@e12e Also, what's your time plan on this? This weekend hackathon? Couple of weeks? Months? For Christmas? Next summer? I'm fine with whatever answer; I'd just like to do some planning :)

lydell commented 8 years ago

Btw, I’m working on adding Hints modes’s shift, ctrl and alt to the help dialog.

e12e commented 8 years ago

@lydell: First, I'm afraid I don't have any solid timeframe to give you - so I suppose it might as well be Christmas :-/ Hopefully sooner rather than later, but until I really get started, I'm afraid I can't make any promises. Sorry about that.

Second: Thank you for the documentation links. I'd browsed them before, but it's always good to be reminded. And thank you for the noscript example :)

Third: Re: config.js/frame.js split: Is this due to sandboxing/permissions/namespacing? Could (should) this be hidden by allowing VimFX to split a single config.js into two temporary files on load (eg: zr -> config.js -> config.conf.js/config.frame.js)? Would it make sense to ship a :mkvimrc-ex-command that set/promted for a config-folder, created the folder if missing, and created two (or one) file with some basic examples commented out, along with a link to documentation? (Sorry to clutter up this issue with that - but it sort of belongs with your other helpful comments here).

Fourth: I was wondering a bit about numbering/enumeration -- and decided to take a couple of screengrabs - this also goes along with my comments on hinting modes above.

I see that vimperator and VimFX seems to number/enumerate links differently - does one of them do it in tab order[1]? Because given that many sites that care about usability sets tab-order/tabindex, it would seem that sorting links with explicit tab-ordering first, in general should lead to better UI/UX?

There's been debate back and forth over the years about html document sequence of links (eg: will putting the whole menu first force a screen-reader to read a long sequence of "top", "about us", "legal" ... before getting to the first headline or not) -- and some sites will put "most important" links first. But it's not always clear if "top" or "This is the first headline" is "most important".

Then there's the issue of filtering and "path length" (number of key-presses) to different links. In my first screen-shot, I show a typical hacker news page in VimFX. Note that:

i) G is re-used - there's no way to get at the second "comments" link (this is probably a bug in VimFX?)

ii) and iii) The most important field, the comment field, is readily available (ff), and so is the second most important link, the "add comment" button (fl). This is IMNHO good :-)

iiii) However, the rather unimportant link "w" (hours ago which on hn links the comment sub-tree) is also given a "short" path (fw), while more important links like the "reply"-link "jn" is given a "longer" path (fjn). Note, I know that HN is exactly a paragon in accessibility, and I don't suggest to optimize VimFX for any one site. But contrast with the two vimperator screen-shots - one with hinting on (like the VimFX shot), the second after typing/filtering on "re". Note that "fre1" is still a "long" path - but the "re"-part is from the text, and doesn't change -- if the user knows that "reply" is the sought function -- and now it's much easier to glance at the "random" labels and find the correct link.

Looking at the VimFX side, it looks like there's some work done in order to prioritize "home row" keys? Or is this particular screen-shot just an artefact of HNs deep and little odd semantic nesting (it's basically a table-based layout - hello 90s!)? Anyway, I thought the images would make things even more clear.

Which brings me to the conclusion about hinting/enumerating links - should there be a strategy for making "short paths". Eg, if there's less than 26*2=56 links, which links should get the "single digit" names, etc. As mentioned I suspect there's already some kind of policy here with VimFX?

[1] See eg: https://www.w3.org/WAI/UA/TS/html401/cp0101/0101-TABINDEX.htmlO

vimfx-hn-hinting vimperator-hint-re1 vimperator-hint-re2

lydell commented 8 years ago

config.js/frame.js split: Is this due to sandboxing/permissions/namespacing?

This is due to multi-process Firefox (a.k.a. Electrolysis and e10s).

Could (should) this be hidden by allowing VimFX to split a single config.js into two temporary files on load (eg: zr -> config.js -> config.conf.js/config.frame.js)?

No. Too complicated.

Would it make sense to ship a :mkvimrc-ex-command that set/promted for a config-folder, created the folder if missing, and created two (or one) file with some basic examples commented out, along with a link to documentation?

No. Also too complicated. Config files are for advanced users. It's more important to keep VimFx small enough so that it is easy to keep working with new Firefox versions. Feel free to suggest how the documentation could be improved, though.

does one of them [Vimperator and VimFx] do it in tab order?

I don't know about Vimperator, but VimFx does not. I've never thought about it before. It might be a good idea! However, I'm not sure when I'll be in the mood of doing such an experiment with hints again. It is a tedious process that takes some time of real every-day usage to evaluate. But if you're up for it, definitely go for it! Giving the most important elements the best hints is very important.

Be sure to read the documentation to learn more:

The most important thing from those links:

"VimFx also tries to give you shorter hints for elements that you are more likely to click. This is done by the surprisingly simple rule: The larger the element, the shorter the hint."

You might also be interested in philc/vimium#2083.

i) G is re-used - there's no way to get at the second "comments" link (this is probably a bug in VimFX?)

Remind me when you get that screen shot up and I'll take a look at it.

ii) and iii) The most important field, the comment field, is readily available (ff), and so is the second most important link, the "add comment" button (fl). This is IMNHO good :-)

Those are large elements, so they get better hints.

the rather unimportant link "w" (hours ago which on hn links the comment sub-tree) is also given a "short" path (fw), while more important links like the "reply"-link "jn" is given a "longer" path (fjn).

That's because the current algorithm favors larger elements. The "reply" links are smaller. (And both links are <a> elements, so there are no other factors in play in this case.) Feel free to suggest something else if you can think of anything.

Looking at the VimFX side, it looks like there's some work done in order to prioritize "home row" keys?

Oh yes. Have a look at https://github.com/akhodakivskiy/VimFx/blob/0bb0e8dff8824c3ed3a95a46a8d82ef45685f157/documentation/options.md#hint-chars.

Which brings me to the conclusion about hinting/enumerating links - should there be a strategy for making "short paths". Eg, if there's less than 26*2=56 links, which links should get the "single digit" names, etc. As mentioned I suspect there's already some kind of policy here with VimFX?

Correct! It feels like I've answered this above. :)

actual images coming

Looking forward to it!

e12e commented 8 years ago

Re: config - ok. (I'll ping you if I can't resist the urge to experiment with that anyway - but I understand the reasoning for why it'll probably not get included in VimFX proper. There's of course an obvious need to port vimp-plug to VimFX to manage config-snippets and ex commands ;-) ).

Re: ordering/hints. Looks like there might be room for a couple of experimental feature branches, I'll focus on "vimperator style hinting" first.

I suppose there's some new ground to break in keyboard-based browsing (in the sense that there aren't that many implementations that have seen actual use on the current, html5/js-rich web)- and size/visibility certainly sounds like one reasonable approach. As mentioned, I don't think optimizing for any one site is a good idea, so it might well be that what VimFX does for "vimfx hinting" is quite good enough.

Note-to-self: Actually, as Firefox allows focusing elements via tab, we should probably be able to get "best" order from FF. Looks like for now it's: document order, higher tabindex-first, (eg: all tabindex=2 elements, in document order, followed by all tabindex=1 in document order, followed by other "unordered" items with tabindex=0 in order. Followed by some(?) tab-able elements in document order, but not those with tabindex=-1). Perhaps the "best" we can do for now is follow tabindex "rules":

http://www.alexlande.com/articles/cross-browser-tabindex-woes/ http://accessites.org/site/2007/05/keyboard-friendly-link-focus/

Note-to-self II: firefox has a built-in shortcut for quick-find link text only, default bound to single-quote: '. It might be possible to leverage for "vimperator style hinting" if it's backed by an api that allows for incremental search (This is what VimFX exposes as "g/" ?).

i) G is re-used - there's no way to get at the second "comments" link (this is probably a bug in VimFX?) Remind me when you get that screen shot up and I'll take a look at it.

You probably saw it, but the images should be accessible now. But given a brief reading of the links you provided, it might not be bugs after all, could simply be a case of "Another way to make hints shorter is to assign the same hint to all links with the same URL. So don’t be surprised if you see the same hint repeated several times." It's not something I feel the need to file a proper bug on for now, anyway - if it really is one, I'm sure to encounter it again on HN, and if so I'll open a (separate) issue.

lydell commented 8 years ago

Re: ordering/hints. Looks like there might be room for a couple of experimental feature branches,

Definitely. VimFx is in no way perfect or optimal, nor will it ever be (just like all other Vimperator, Pentadactyl and Vimium won't either). Improvements are very much welcome!

Firefox has a built-in shortcut for quick-find link text only, default bound to single-quote: '. It might be possible to leverage for "vimperator style hinting" if it's backed by an api that allows for incremental search (This is what VimFX exposes as "g/" ?).

Yes, that's what VimFx exposes as g/. Don't know how useful it is, though.

i) G is re-used - there's no way to get at the second "comments" link (this is probably a bug in VimFX?) ... It's not something I feel the need to file a proper bug on for now, anyway - if it really is one, I'm sure to encounter it again on HN, and if so I'll open a (separate) issue.

Thanks to your screen shot I know get it. Yes, you're right in that it is simply a case of "Another way to make hints shorter is to assign the same hint to all links with the same URL. So don’t be surprised if you see the same hint repeated several times." Yes, you will encounter it again on HN, as well as other sites. No need to open an issue, because it is working as intended. Both of the links labeled with "G" in your screen shot do exactly the same thing, so your "there's no way to get at the second 'comments' link" statement is false.

doy commented 8 years ago

I'm also very interested in this - I just switched from pentadactyl and this is the one thing that still trips me up regularly that I haven't been able to either configure away or get used to.

lydell commented 8 years ago

@doy team up with @e12e and go for it!

doy commented 8 years ago

Work started here https://github.com/doy/VimFx/tree/pentadactyl-hints - we'll see how well it turns out(:

e12e commented 8 years ago

Hi,

I just got a new job that's likely to take much (all) of my time for the coming weeks. I'm still interested in this, but it's unlikely I'll have any time for it for at least the next few weeks. If time allows, I'll at least try to help test. Just a heads up so no one waits for my input on this.

lydell commented 8 years ago

This is now available in the development version.

pankk commented 7 years ago

For those looking for this feature and struggle (like me) to find that it (mostly) actually works after a small settings tweak: Go to Add-ons, go to VimFx's Options, change Hint characters to only numbers. Now when you type a part of the link it should work! If this is documented elsewhere and I failed to find it, please do point it out.

lydell commented 7 years ago

There is a hint already in the description for the hint characters option.

The set of characters for hint markers. Some prefer all uppercase, or numbers only. All other characters are used to filter by element text (case insensitively).

Apart from that, it is mentioned in the Questions and Answers, which links to the documentation for hint characters which says:

Tip: Prefer filtering hints by element text? Use only uppercase hint characters (such as FJDKSLAGHRUEIWONC MV), or only numbers (01234567 89).

pankk commented 7 years ago

Thanks @lydell. I read that description at least 3 times. I think it's time for a holiday.