philc / vimium

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

Possible to exclude certain urls from "visitPreviousTab" behavior? #3938

Open dragon788 opened 2 years ago

dragon788 commented 2 years ago

https://github.com/philc/vimium/blob/1d80e66aa20f7f1d17d7f16ee046b1253368aa16/background_scripts/main.js#L331-L335

Use case: I do probably 90% of my work on a Chromebook, and one of the things that threw me for a bit of a loop was that when switching between the Terminal (Linux apps terminal emulator) or Secure Shell (ssh app/extension) or the Crosh window (non-Linux apps shell), if I switch to a browser tab after being in one of these other "apps", hitting ^ in Vimium brings me back to the shell window.... This isn't totally unexpected, because they ARE just browser windows, but they often have chrome-extension:// URLs so I sort of expected they would be excluded from Vimium's navigation, but after looking at the code, it is just a simple hook to a browser function with no logic around WHAT the previous tab might be.

The biggest issue with these chrome-extension:// URLs is that while Vimium can take me there, I can't use ^ after that because Vimium doesn't load in any chrome*:// windows. So I end up having to find my actual previous tab, and then remember to navigate to the other tab I meant to open with T so get "around" the chrome-extension:// window.

I do like having these chrome-extension:// URLs available to T because it basically replaces Alt+Tab with a smarter frecency switcher (very similar to my rofi setup in Linux), but I wish they could be filtered from the ^ list.

gdh1995 commented 2 years ago

Currently not available in Vimium yet.

You may try my customized version of Vimium - Vimium C (https://github.com/gdh1995/vimium-c), and it supports filter in some tab-related commands:

# url=<an regexp starting with "^">
map xxx visitPreviousTab filter="url=^(?!chrome-extension)"
# you may also add other filters, like
map mmm closeOtherTabs filter="audible=true&muted=false"