Skip to content

Commit 5c7ffbe

Browse files
committed
Merge pull request #367 from ratijas/master
added :panorama rename subcommand
2 parents 3579504 + 671e398 commit 5c7ffbe

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

vimperator/content/tabgroup.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,35 @@ const TabGroup = Module("tabGroup", {
347347
literal: 0,
348348
completer: function (context) completion.tabgroup(context, false),
349349
}),
350+
/**
351+
* Panorama SubCommand rename
352+
* rename {name}.
353+
* clear the name of the current group if bang(!) specified and {name} is ommited.
354+
*/
355+
new Command(["rename", "mv"], "Rename current tab group (or reset to '(Untitled)').",
356+
function (args) {
357+
let title = args.literalArg;
358+
if (!title) {
359+
if (args.bang)
360+
title = "";
361+
else {
362+
liberator.echoerr("No title supplied! Add \"!\" if want to clear it.");
363+
return;
364+
}
365+
}
366+
let activeGroup = tabGroup.tabView.GroupItems.getActiveGroupItem();
367+
if (activeGroup)
368+
activeGroup.setTitle(title);
369+
}, {
370+
bang: true,
371+
literal: 0,
372+
completer: function (context) {
373+
context.title = ["Rename current group"];
374+
let activeGroup = tabGroup.tabView.GroupItems.getActiveGroupItem();
375+
let title = activeGroup ? activeGroup.getTitle() : "";
376+
context.completions = title ? [[title, ""]] : [];
377+
}
378+
}),
350379
/**
351380
* Panorama SubCommand switch
352381
* switch to the {group}.

vimperator/locale/en-US/tabs.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@
123123
</description>
124124
</item>
125125

126+
<item>
127+
<tags>tabgroups-rename tabgroups-mv</tags>
128+
<spec>rename<oa>!</oa> <oa>newGroupName</oa></spec>
129+
<spec>mv<oa>!</oa> <oa>newGroupName</oa></spec>
130+
<description>
131+
<p>
132+
Rename current tab group to <oa>newGroupName</oa>.
133+
</p>
134+
<p>
135+
If <oa>newGroupName</oa> is not supplied and <oa>!</oa> is
136+
specified, resets group's name to <o>(Untitled)</o>.
137+
</p>
138+
</description>
139+
</item>
140+
126141
<item>
127142
<tags>tabgroups-switch</tags>
128143
<spec><oa>count</oa>switch <a>groupName</a></spec>

0 commit comments

Comments
 (0)