philc / vimium

The hacker's browser.
https://chrome.google.com/webstore/detail/vimium/dbepggeogbaibhgnhhndojpepiihcmeb
MIT License
23.54k stars 2.49k forks source link

[Feature Request] Keyword option in Vomnibar.activateTabSelection in preferences. #3027

Open az-pz opened 6 years ago

az-pz commented 6 years ago

Currently, you can use keyword option only for Vomnibar.activate and Vomnibar.activateInNewTab (https://github.com/philc/vimium/wiki/Tips-and-Tricks#keyboard-shortcuts-for-custom-search-engines ). keyword option should be available for other vomnibar commands like Vomnibar.activateTabSelection. This way, user can map keyboard shortcut to a bookmark or a tab. Example: map s Vomnibar.activateTabSelection keyword=slack Pressing 's' opens first result of 'slack' input in Vomnibar.activateTabSelection .

smblott-github commented 6 years ago

You could try using global marks. See also here.

az-pz commented 6 years ago

Thank you smblott for your response. The problem with global marks is that it does not switch to the tab if the url of the tab changes after mark creation. It opens a new tab with tab url when the mark was created. In slack, every channel and thread has different url.
Vomnibar.activateTabSelection with keyword argument switch to the tab if we give tab title as keyword argument.

smblott-github commented 6 years ago

The problem with global marks is that it does not switch to the tab if the url of the tab changes after mark creation.

Yes it does. It switches to the first tab for which the URL of the mark is a prefix of the URL of the tab. And if no such tab exists, then it creates a new tab.

az-pz commented 6 years ago

I created a mark on 'https://github.com/philc/vimium' page. I can switch to the mark. Now, I clicked on issues button. The url of the page is "https://github.com/philc/vimium/issues". When I try switching to the mark, it opens a new tab with "https://github.com/philc/vimium" url. It doesn't behave the way you are saying it should. Or, am I doing something wrong here? My custom key mapping for mark: map m Marks.activateCreateMode swap map M Marks.activateGotoMode swap

smblott-github commented 6 years ago

Or, am I doing something wrong here?

Not that I can tell.

What I describe (and the behaviour you want) works here for me.

There's another requirement, which slipped my mind.

It only works if the scroll offset is 0 (when you create the mark). So scroll to the top of the page first.

az-pz commented 6 years ago

Scroll to top before creating global mark works for me. But in my case, I want to switch to slack with one key and global mark can't help me since I can not create mark on root url (foo.slack.com). Slack opens with one of the threads (foo.slack.com/messages/bar).

I don't know how widespread this usecase would be, but I think there should be keyword argument for Vomnibar.activateTabSelection in preferences. Thank you for response, smblott.