Created
June 10, 2010 18:11
-
-
Save littlefolk/433387 to your computer and use it in GitHub Desktop.
vimperator plugin: previous tab *loaded*
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 次の未読タブへ移動 {{{ | |
// @http://gist.github.com/433387 | |
(function(){ | |
if (liberator.plugins.browser_object_api) { | |
[ | |
[ | |
['gj', 'sj'], 'Go to the next tab *loaded*.', | |
function (count) { | |
tabs.select( | |
( | |
browser_object_api.loaded(browser_object_api.right())[(count || 1)] || | |
browser_object_api.loaded()[((count && count - 1) || 0)] || | |
browser_object_api.loaded().pop() | |
)._tPos | |
); | |
} | |
], [ | |
['gk', 'sk'], 'Go to the previous tab *loaded*.', | |
function (count) { | |
tabs.select( | |
( | |
browser_object_api.loaded(browser_object_api.left()).reverse()[(count || 1)] || | |
browser_object_api.loaded().reverse()[((count && count - 1) || 0)] || | |
browser_object_api.loaded().shift() | |
)._tPos | |
); | |
} | |
], [ | |
['gJ', 'sJ'], 'Go to the next *root* tab *loaded*.', | |
function (count) { | |
let parent = TreeStyleTabService.getParentTab(gBrowser.mCurrentTab); | |
tabs.select( | |
( | |
browser_object_api.right(browser_object_api.loaded(TreeStyleTabService.rootTabs))[((parent)? 0: (count || 1))] || | |
browser_object_api.loaded(TreeStyleTabService.rootTabs)[((count && count - 1) || 0)] || | |
browser_object_api.loaded(TreeStyleTabService.rootTabs).pop() | |
)._tPos | |
); | |
} | |
], [ | |
['gK', 'sK'], 'Go to the previous *root* tab *loaded*.', | |
function (count) { | |
let parent = TreeStyleTabService.getParentTab(gBrowser.mCurrentTab); | |
tabs.select( | |
( | |
browser_object_api.left(browser_object_api.loaded(TreeStyleTabService.rootTabs)).reverse()[(parent)? 0: (count || 1)] || | |
browser_object_api.loaded(TreeStyleTabService.rootTabs).reverse()[((count && count - 1) || 0)] || | |
browser_object_api.loaded().shift() | |
)._tPos | |
); | |
} | |
], | |
].forEach(function ([keys, description, action]) mappings.addUserMap([modes.NORMAL], keys, description, action, {count: true})); | |
}; | |
})(); | |
// }}} | |
// vim: sw=2 ts=2 et si fdm=marker: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment