This commit is contained in:
Oliver Blanthorn 2026-09-05 09:43:39 -07:00 committed by GitHub
commit 2c9fd3fb94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 0 deletions

View file

@ -2819,6 +2819,20 @@ export async function tabprev(...args: string[]) {
}) })
} }
/**
* Switch to the previously used tab, ignoring any tabs used within the last 10 seconds. Handy for flicking through previous tabs.
*/
//#background
export async function tabnextmru() {
return browser.tabs.query({ currentWindow: true, hidden: false }).then(tabs => {
tabs.sort((a, b) => b.lastAccessed - a.lastAccessed)
console.log(tabs)
const mru_ish = tabs.findIndex(t => Date.now() - t.lastAccessed - 10000 > 0)
console.log(mru_ish)
return browser.tabs.update(tabs[(mru_ish > -1 ? mru_ish : 1)].id, { active: true })
})
}
/** /**
* Pushes the current tab to another window. Only works for windows of the same type * Pushes the current tab to another window. Only works for windows of the same type
* (can't push a non-private tab to a private window or a private tab to * (can't push a non-private tab to a private window or a private tab to

View file

@ -478,6 +478,7 @@ export class default_config {
browsermaps = { browsermaps = {
"<C-,>": "escapehatch", "<C-,>": "escapehatch",
"<C-6>": "tab #", "<C-6>": "tab #",
"<C-7>": "tabnextmru",
// "<CS-6>": "tab #", // banned by e2e tests // "<CS-6>": "tab #", // banned by e2e tests
} }

View file

@ -43,6 +43,10 @@
} }
}, },
"command_4": { "command_4": {
"suggested_key": {
"default": "MacCtrl+7",
"windows": "Alt+7"
},
"description": "Internal use. See `:help bind`. Use `:bind --mode=browser` to change - do not change here." "description": "Internal use. See `:help bind`. Use `:bind --mode=browser` to change - do not change here."
}, },
"command_5": { "command_5": {