diff --git a/content/tabs.js b/content/tabs.js index 98ce8ea7..53810fdf 100644 --- a/content/tabs.js +++ b/content/tabs.js @@ -373,10 +373,29 @@ liberator.Tabs = function () //{{{ 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]"], "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); } }); liberator.commands.add(["buffers", "files", "ls", "tabs"], diff --git a/locale/en-US/tabs.txt b/locale/en-US/tabs.txt index afcdf42d..13d26062 100644 --- a/locale/en-US/tabs.txt +++ b/locale/en-US/tabs.txt @@ -103,10 +103,10 @@ ________________________________________________________________________________ |: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 -full URL. +Go to the specified buffer from the buffer list. Argument can be either the +buffer index or the full URL. 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