1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-04 21:55:46 +01:00

add count support to :buffer

This commit is contained in:
Doug Kearns
2008-08-14 04:03:21 +00:00
parent e480e466dc
commit be5c793f4f
2 changed files with 24 additions and 5 deletions

View File

@@ -373,10 +373,29 @@ liberator.Tabs = function () //{{{
if (liberator.config.name == "Vimperator") if (liberator.config.name == "Vimperator")
{ {
// TODO: add count support // TODO: "Zero count" if 0 specified as arg, multiple args and count ranges?
liberator.commands.add(["b[uffer]"], liberator.commands.add(["b[uffer]"],
"Switch to a buffer", "Switch to a buffer",
function (args, special) { liberator.tabs.switchTo(args, special); }, function (args, special, count)
{
// if a numeric arg is specified any count is ignored; if a
// count and non-numeric arg are both specified then E488
if (args && count > 0)
{
if (/^\d+$/.test(args))
liberator.tabs.switchTo(args, special);
else
liberator.echoerr("E488: Trailing characters");
}
else if (count > 0)
{
liberator.tabs.switchTo(count.toString(), special);
}
else
{
liberator.tabs.switchTo(args, special);
}
},
{ completer: function (filter) { return liberator.completion.buffer(filter); } }); { completer: function (filter) { return liberator.completion.buffer(filter); } });
liberator.commands.add(["buffers", "files", "ls", "tabs"], liberator.commands.add(["buffers", "files", "ls", "tabs"],

View File

@@ -103,10 +103,10 @@ ________________________________________________________________________________
|:b| |:buffer| |:b| |:buffer|
||:b[uffer][!] {url|index}|| + ||[count]:b[uffer][!] {url|index}|| +
________________________________________________________________________________ ________________________________________________________________________________
Go to buffer from buffer list. Argument can be either the buffer index or the Go to the specified buffer from the buffer list. Argument can be either the
full URL. buffer index or the full URL.
If argument is neither a full URL nor an index but uniquely identifies a If argument is neither a full URL nor an index but uniquely identifies a
buffer, it is selected. With [!] the next buffer matching the argument is buffer, it is selected. With [!] the next buffer matching the argument is