diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index af2cbd06..7174ed00 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -312,7 +312,19 @@ function Commands() //{{{ } )); addDefaultCommand(new Command(["b[uffer]"], - buffer_switch, + // TODO: move to v.tabs/buffers + function(args) + { + var match; + if (match = args.match(/^(\d+):?/)) + return vimperator.tabs.select(parseInt(match[1]) - 1, false); // make it zero-based + for (var i = 0; i < getBrowser().browsers.length; i++) + { + var url = getBrowser().getBrowserAtIndex(i).contentDocument.location.href; + if (url == args) + return vimperator.tabs.select(i, false); + } + }, { usage: ["b[uffer] {url|index}"], short_help: "Go to buffer from buffer list", @@ -321,7 +333,18 @@ function Commands() //{{{ } )); addDefaultCommand(new Command(["buffers", "files", "ls", "tabs"], - toggleBufferList, + // TODO: move to v.tabs/buffers + function() + { + if (vimperator.bufferwindow.visible()) + vimperator.bufferwindow.hide(); + else + { + var items = get_buffer_completions(""); + vimperator.bufferwindow.show(items); + vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex); + } + }, { usage: ["buffers"], short_help: "Show a list of all buffers (=tabs)", @@ -1366,31 +1389,6 @@ function tab() execute(arguments[0], null, null, {inTab: true}); } -function buffer_switch(string) -{ - var match; - if (match = string.match(/^(\d+):?/)) - return vimperator.tabs.select(parseInt(match[1]) - 1, false); // make it zero-based - for (var i = 0; i < getBrowser().browsers.length; i++) - { - var url = getBrowser().getBrowserAtIndex(i).contentDocument.location.href; - if (url == string) - return vimperator.tabs.select(i, false); - } -} - -//toggles the buffer preview window -function toggleBufferList() -{ - if (vimperator.bufferwindow.visible()) - vimperator.bufferwindow.hide(); - else - { - var items = get_buffer_completions(""); - vimperator.bufferwindow.show(items); - vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex); - } -} // updates the buffer preview in place only if list is visible function updateBufferList() { @@ -1622,7 +1620,7 @@ Vimperator.prototype.source = function(filename, silent) function getEnv(variable) { var environment = Components.classes["@mozilla.org/process/environment;1"] - .getService(Components.interfaces.nsIEnvironment); + .getService(Components.interfaces.nsIEnvironment); return environment.get(variable); } diff --git a/chrome/content/vimperator/help.js b/chrome/content/vimperator/help.js index f0956be5..f0ca0800 100644 --- a/chrome/content/vimperator/help.js +++ b/chrome/content/vimperator/help.js @@ -239,7 +239,7 @@ function help(section, easter) //{{{ function findSectionElement(section) { return evaluateXPath('//code[@class="tag" and text()="' + section + '"]') - .snapshotItem(0); + .snapshotItem(0); } var element = findSectionElement(section); diff --git a/chrome/content/vimperator/mappings.js b/chrome/content/vimperator/mappings.js index f1d54afd..fb2804f7 100644 --- a/chrome/content/vimperator/mappings.js +++ b/chrome/content/vimperator/mappings.js @@ -220,7 +220,7 @@ function Mappings() //{{{ } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["B"], - toggleBufferList, + function() { vimperator.commands.buffers(); }, { short_help: "Toggle buffer list", help: "Toggles the display of the buffer list which shows all opened tabs." @@ -402,7 +402,7 @@ function Mappings() //{{{ } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["u"], - function(count) { execute_command(count, 'undo', false, ''); }, + function(count) { vimperator.commands.undo("", false, count); }, { short_help: "Undo closing of a tab", help: "If a count is given, don't close the last but the n'th last tab.", diff --git a/chrome/content/vimperator/options.js b/chrome/content/vimperator/options.js index 0cea3ecd..15a0379f 100644 --- a/chrome/content/vimperator/options.js +++ b/chrome/content/vimperator/options.js @@ -88,7 +88,7 @@ function Options() //{{{ /////////////////////////////////////////////////////////////////////////////{{{ var firefox_prefs = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefBranch); + .getService(Components.interfaces.nsIPrefBranch); var vimperator_prefs = firefox_prefs.getBranch("extensions.vimperator."); var options = []; diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index da3a0603..f9a11ed2 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -192,7 +192,7 @@ function Vimperator() //{{{ // our services var console_service = Components.classes['@mozilla.org/consoleservice;1'] - .getService(Components.interfaces.nsIConsoleService); + .getService(Components.interfaces.nsIConsoleService); function showMode() {