tats/w3m

Feature suggestion: "clickable" links using keyboard shortcuts

Opened this issue · 5 comments

Hi there,

I noticed on other browsers (qutebrowser, chrome with vimium) that there is a feature which might be well suited to w3m as well. I'm not sure how you call it, but when you press the "f" key all hyperlinks visible in the window have a 1 or 2 key combination assigned to them. Then to follow that link you can type that combination.

Also capital F would produce the same combinations but opening in a new tab

I don't have much experience with C but would be happy to give it a try if the maintainers think it's possible/not too difficult!

rkta commented

is usually refer to as Hinting mode/Hint mode and yes w3m already has it built-in, you just need to enable it.
It uses numbers not characters but is the same idea.

in the options panel > Display Link Number [Yes] > OK
usage: press 3[ to jump to link 3
example video: https://www.youtube.com/watch?v=8-11SkjJVdo

if you want to rebind the key to use f to jump instead e.g press 3f
keymap f LINK_BEGIN
e.g press 3F to open in new tab
keymap F COMMAND "LINK_BEGIN; TAB_LINK"
quick toggle hinting mode on/off
keymap = COMMAND "SET_OPTION display_link_number=toggle ; RESHAPE"

I tried both methods out and had some comments:

  • The LIST_MENU appears to do what I'm asking, but the menu could be a bit painful if you're on a page with many links and have to scroll.
  • the link numbers are good because you can look at the link and immediately know the shortcut (without having to search in another menu), but I find the number keys are a bit difficult to do with accuracy and speed

Would it be feasable to add a command which sort of combines these two methods?
eg. similar to LIST_MENU which creates those key shortcuts, but instead of bringing up the menu, it places them in the square brackets next to the link (like in the display_link_number)?
And then rather than 1a,1b,1c etc, prioritizes the home row for ease of typing

I think that would improve navigating experience/speed, but yeah just a suggestion!

that would be nice to toggle on hinting mode then press a-z hotkey then it auto toggle off again, like in gui browsers.
think the reason why it uses 0-9 instead of a-z keys because most of those a-z keys are already binded (think vim normal mode).
the list_menu popup menu has a different mode so any hotkeys in your keymap file does not work in there, thats why you can use a-z/0-9