mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 16:12:26 +01:00
add prefix count support to :tabprevious, :bprevious, :tabnext, :bnext etc
This commit is contained in:
1
NEWS
1
NEWS
@@ -15,6 +15,7 @@
|
||||
generous donation which made this behavior possible)
|
||||
* IMPORTANT: ctrl-x/a never take possible negative URLs into account, it was just
|
||||
too unpredictable
|
||||
* :tabprevious, :bprevious, :tabnext, :bnext and friends now accept a prefix count
|
||||
* add :comclear and :delcommand
|
||||
* add a special version to :hardcopy to skip the Print dialog
|
||||
* add :bl[ast], :bf[irst], :br[ewind] to go to first/last tab
|
||||
|
||||
@@ -304,31 +304,56 @@ liberator.Tabs = function () //{{{
|
||||
"Switch to the last tab",
|
||||
function () { liberator.tabs.select("$", false); });
|
||||
|
||||
// TODO: count support
|
||||
// TODO: "Zero count" if 0 specified as arg
|
||||
liberator.commands.add(["tabp[revious]", "tp[revious]", "tabN[ext]", "tN[ext]", "bp[revious]", "bN[ext]"],
|
||||
"Switch to the previous tab or go [count] tabs back",
|
||||
function (args)
|
||||
function (args, special, count)
|
||||
{
|
||||
if (!args)
|
||||
liberator.tabs.select("-1", true);
|
||||
else if (/^\d+$/.test(args))
|
||||
// count is ignored if an arg is specified, as per Vim
|
||||
if (args)
|
||||
{
|
||||
if (/^\d+$/.test(args))
|
||||
liberator.tabs.select("-" + args, true); // FIXME: urgh!
|
||||
else
|
||||
liberator.echoerr("E488: Trailing characters");
|
||||
}
|
||||
else if (count > 0)
|
||||
{
|
||||
liberator.tabs.select("-" + count, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
liberator.tabs.select("-1", true);
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: count support
|
||||
// TODO: "Zero count" if 0 specified as arg
|
||||
liberator.commands.add(["tabn[ext]", "tn[ext]", "bn[ext]"],
|
||||
"Switch to the next or [count]th tab",
|
||||
function (args)
|
||||
function (args, special, count)
|
||||
{
|
||||
if (!args)
|
||||
if (args || count > 0)
|
||||
{
|
||||
liberator.tabs.select("+1", true);
|
||||
var index;
|
||||
|
||||
// count is ignored if an arg is specified, as per Vim
|
||||
if (args)
|
||||
{
|
||||
if (/^\d+$/.test(args))
|
||||
{
|
||||
index = args - 1;
|
||||
}
|
||||
else if (/^\d+$/.test(args))
|
||||
else
|
||||
{
|
||||
var index = parseInt(args, 10) - 1;
|
||||
liberator.echoerr("E488: Trailing characters");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
index = count - 1;
|
||||
}
|
||||
|
||||
if (index < liberator.tabs.count)
|
||||
liberator.tabs.select(index, true);
|
||||
else
|
||||
@@ -336,7 +361,7 @@ liberator.Tabs = function () //{{{
|
||||
}
|
||||
else
|
||||
{
|
||||
liberator.echoerr("E488: Trailing characters");
|
||||
liberator.tabs.select("+1", true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -347,6 +372,7 @@ liberator.Tabs = function () //{{{
|
||||
|
||||
if (liberator.config.name == "Vimperator")
|
||||
{
|
||||
// TODO: add count support
|
||||
liberator.commands.add(["b[uffer]"],
|
||||
"Switch to a buffer",
|
||||
function (args, special) { liberator.tabs.switchTo(args, special); },
|
||||
@@ -373,6 +399,7 @@ liberator.Tabs = function () //{{{
|
||||
"Reload all tab pages",
|
||||
function (args, special) { liberator.tabs.reloadAll(special); });
|
||||
|
||||
// TODO: add count support
|
||||
liberator.commands.add(["tabm[ove]"],
|
||||
"Move the current tab after tab N",
|
||||
function (args, special)
|
||||
|
||||
@@ -120,9 +120,9 @@ ________________________________________________________________________________
|
||||
|
||||
|
||||
|:bn| |:bnext| |:tn| |:tnext| |:tabn| |:tabnext|
|
||||
||:tabn[ext] [count]|| +
|
||||
||:tn[ext] [count]|| +
|
||||
||:bn[ext] [count]||
|
||||
||:[count]tabn[ext] [count]|| +
|
||||
||:[count]tn[ext] [count]|| +
|
||||
||:[count]bn[ext] [count]||
|
||||
________________________________________________________________________________
|
||||
Switch to the next or [count]th tab. Cycles to the first tab when the last is
|
||||
selected and {count} is not specified.
|
||||
@@ -137,11 +137,11 @@ ________________________________________________________________________________
|
||||
|
||||
|
||||
|:bN| |:bNext| |:bp| |:bprevious| |:tN| |:tNext| |:tabN| |:tabNext| |:tp| |:tprevious| |:tabp| |:tabprevious|
|
||||
||:tabp[revious] [count]|| +
|
||||
||:tp[revious] [count]|| +
|
||||
||:tabN[ext] [count]|| +
|
||||
||:bp[revious] [count]|| +
|
||||
||:bN[ext] [count]||
|
||||
||:[count]tabp[revious] [count]|| +
|
||||
||:[count]tp[revious] [count]|| +
|
||||
||:[count]tabN[ext] [count]|| +
|
||||
||:[count]bp[revious] [count]|| +
|
||||
||:[count]bN[ext] [count]||
|
||||
________________________________________________________________________________
|
||||
Switch to the previous tab or go [count] tabs back. Wraps around from the
|
||||
first tab to the last tab.
|
||||
|
||||
Reference in New Issue
Block a user