diff options
author | teramako | 2010-12-08 09:54:16 +0900 |
---|---|---|
committer | teramako | 2010-12-08 09:54:16 +0900 |
commit | e82b73368ef819c9b53ab759df40b7014a44b087 (patch) | |
tree | 2a1b05843984322468543ba5bd0011b86767df6e | |
parent | bced75ab3fb73ecd4965171e06383f84b8741642 (diff) | |
download | vimperator-plugins-e82b73368ef819c9b53ab759df40b7014a44b087.tar.bz2 |
add :rmg[roup] command
-rw-r--r-- | panorama.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/panorama.js b/panorama.js index 3fb61d1..a14efdf 100644 --- a/panorama.js +++ b/panorama.js @@ -497,6 +497,41 @@ commands.addUserCommand(["stash[togroup]"], "Stash the current tab to other grou completer: function (context) completion.tabgroup(context, true), }, true); +commands.addUserCommand(["rmg[roup]"], "close all tabs in the group", + function (args) { + let groupName = args.literalArg; + const GI = tabView.GroupItems; + let activeGroup = GI.getActiveGroupItem(); + let group = groupName ? getGroupByName(groupName)[0] : activeGroup; + liberator.assert(group, "No such group: " + groupName); + + if (group === activeGroup) { + if (gBrowser.visibleTabs.length < gBrowser.tabs.length) { + switchToGroup("+1", true); + } else { + let apps = appTabs; + let gb = gBrowser; + let vtabs = gb.visibleTabs; + if (apps.length == 0) { + // 最後尾にabout:blankなタブをフォアグランドに開く + gb.loadOenTab("about:blank", { inBackground: false, relatedToCurrent: false }); + } else { + // AppTabがあればそれをとりあえず選択しておく + gb.mTabContainer.selectedIndex = apps.length -1; + } + for (let i = vtabs.length -1, tab; (tab = vtabs[i]) && !tab.pinned; i--) { + gb.removeTab(tab); + } + return; + } + } + group.closeAll(); + }, { + argCount: "?", + literalArg: 0, + completer: function (context) completion.tabgroup(context, false), + }); + // }}} // ============================================================================ |