Skip to content

Instantly share code, notes, and snippets.

@littlefolk
Created June 3, 2010 10:48
Show Gist options
  • Save littlefolk/423733 to your computer and use it in GitHub Desktop.
Save littlefolk/423733 to your computer and use it in GitHub Desktop.
vimperator plugin: wakeup
// :wakeup --- BarTabで待機させている複数のタブを、BrowserObject風のオプションで指定して読み込む {{{
// @http://github.com/philikon/BarTab/blob/master/modules/prototypes.js#L236
(function(){
if (liberator.plugins.browser_object_api) {
commands.addUserCommand(
['wak[eup]'], 'Wake up!Wake up!Wake up!',
browser_object_api.select(args.string, args["-number"]).forEach(function (aTab) gBrowser.BarTabHandler.loadTab(aTab));
{options: browser_object_api.options},
true
);
// mappings
// {g:browser_object_prefix} + w + {scope} + {target}
browser_object_api.options.
filter(function (arr) (arr[1] == commands.OPTION_NOARG)).
map(function (arr) arr[0][0]).
forEach(function (scope) {
let _ = scope.charAt(1);
mappings.addUserMap(
[modes.NORMAL],
[(liberator.globalVariables.browser_object_prefix || "") + "w" + _ + "t"],
"wakeup " + scope + " tabs",
function (count) browser_object_api.select("-" + _, count).forEach(function (aTab) gBrowser.BarTabHandler.loadTab(aTab)),
{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