diff options
author | teramako | 2010-12-08 01:33:58 +0900 |
---|---|---|
committer | teramako | 2010-12-08 01:37:20 +0900 |
commit | bced75ab3fb73ecd4965171e06383f84b8741642 (patch) | |
tree | 5bdcf1b9c0d3f017a2141a25fcae5cb660df834c | |
parent | 90b88005152c3a7a8cb84389d6a744ceb0e747af (diff) | |
download | vimperator-plugins-bced75ab3fb73ecd4965171e06383f84b8741642.tar.bz2 |
update :mkgroup command to switch the group after made a group
-rw-r--r-- | panorama.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/panorama.js b/panorama.js index 3f1c715..3fb61d1 100644 --- a/panorama.js +++ b/panorama.js @@ -47,7 +47,7 @@ let INFO = <> <tags>:mkgroup :mkg</tags> <spec>:mkg<oa>roup</oa><oa>!</oa> <oa>GroupName</oa></spec> <description> - <p>Create new tab group named <a>GroupName</a>.</p> + <p>Create new tab group named <a>GroupName</a>. And then, switch to the group.</p> <p>If specified <a>!</a>, move the current tab to the group.</p> </description> </item> @@ -428,15 +428,30 @@ let (cmd = commands.get("buffer")) { cmd.completer = function (context) completion.buffer(context, true); } +/** + * make a group and switch to the group + * if add ! (bang), take up the current tab to the group + */ commands.addUserCommand(["mkg[roup]"], "create Group", function (args) { let groupName = args.literalArg; let group = createGroup(groupName); + let currentTab = tabs.getTab(); if (args.bang) { - let currentTab = tabs.getTab(); if (!currentTab.pinned) TV.moveTabTo(currentTab, group.id); } + let apps = appTabs, + child = group.getChild(0); + if (child) { + tabView.GroupItems.setActiveGroupItem(group); + tabView.UI.goToTab(child.tab); + } else if (apps.length == 0) { + group.newTab(); + } else { + tabView.GroupItems.setActiveGroupItem(group); + tabView.UI.goToTab(currentTab.pinned ? currentTab : apps[apps.length - 1]); + } }, { argCount: "1", bang: true, |