diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 3289a5c9..8d090794 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -397,7 +397,7 @@ function Commands() //{{{ } )); addDefaultCommand(new Command(["exu[sage]"], - function() { help("commands"); }, + function(args, special, count, modifiers) { vimperator.help("commands", special, null, modifiers); }, { usage: ["exu[sage]"], short_help: "Show help for Ex commands" @@ -427,7 +427,7 @@ function Commands() //{{{ } )); addDefaultCommand(new Command(["h[elp]"], - help, + function(args, special, count, modifiers) { vimperator.help(args, special, null, modifiers); }, { usage: ["h[elp] {subject}"], short_help: "Open the help window", @@ -620,7 +620,7 @@ function Commands() //{{{ } )); addDefaultCommand(new Command(["se[t]"], - function(args, special) + function(args, special, count, modifiers) { if (args == "") { @@ -888,7 +888,7 @@ function Commands() //{{{ } )); addDefaultCommand(new Command(["viu[sage]"], - function() { help("mappings"); }, + function(args, special, count, modifiers) { vimperator.help("mappings", special, null, modifiers); }, { usage: ["viu[sage]"], short_help: "Show help for normal mode commands" diff --git a/chrome/content/vimperator/help.js b/chrome/content/vimperator/help.js index f0ca0800..201e24e5 100644 --- a/chrome/content/vimperator/help.js +++ b/chrome/content/vimperator/help.js @@ -26,7 +26,7 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ -function help(section, easter) //{{{ +Vimperator.prototype.help = function(section, easter) //{{{ { if (easter) { @@ -210,29 +210,29 @@ function help(section, easter) //{{{ return false; openURLs("about:blank"); - setTimeout(function () { help(section, false, null, {recursive: true}); }, 250); + setTimeout(function () { vimperator.help(section, false, null, {recursive: true}); }, 250); return; } doc.write(fulldoc); doc.close(); - function cumulativeOffset(element) - { - var valueT = 0, valueL = 0; - if (!element) - return [0, 0]; + function cumulativeOffset(element) + { + var valueT = 0, valueL = 0; + if (!element) + return [0, 0]; - do - { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } - while (element); + do + { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } + while (element); - return [valueL, valueT]; - } + return [valueL, valueT]; + } if (section) { diff --git a/chrome/content/vimperator/mappings.js b/chrome/content/vimperator/mappings.js index 68504cb9..5ebb4c4c 100644 --- a/chrome/content/vimperator/mappings.js +++ b/chrome/content/vimperator/mappings.js @@ -199,7 +199,7 @@ function Mappings() //{{{ * Normal mode */ addDefaultMap(new Map(vimperator.modes.NORMAL, ["'", "`"], - function (mark) { vimperator.marks.jumpTo(mark) }, + function(mark) { vimperator.marks.jumpTo(mark) }, { short_help: "Jump to the mark in the current buffer", usage: ["'{a-zA-Z0-9}"], @@ -207,14 +207,16 @@ function Mappings() //{{{ flags: Mappings.flags.ARGUMENT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["]f"], function(count) { focusNextFrame(count > 1 ? count : 1, true); }, + addDefaultMap(new Map(vimperator.modes.NORMAL, ["]f"], + function(count) { focusNextFrame(count > 1 ? count : 1, true); }, { short_help: "Focus next frame", help: "Transfers keyboard focus to the [count]th next frame in order. The newly focused frame is briefly colored red.", flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["[f"], function(count) { focusNextFrame(count > 1 ? count : 1, false); }, + addDefaultMap(new Map(vimperator.modes.NORMAL, ["[f"], + function(count) { focusNextFrame(count > 1 ? count : 1, false); }, { short_help: "Focus previous frame", help: "Transfers keyboard focus to the [count]th previous frame in order. The newly focused frame is briefly colored red.", @@ -222,7 +224,7 @@ function Mappings() //{{{ } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["b"], - function (args) { vimperator.commandline.open(":", "buffer ", vimperator.modes.EX); }, + function(args) { vimperator.commandline.open(":", "buffer ", vimperator.modes.EX); }, { short_help: "Open a prompt to switch buffers", help: "Typing the corresponding number opens switches to this buffer." @@ -266,7 +268,7 @@ function Mappings() //{{{ } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["go"], - function (mark) { vimperator.quickmarks.jumpTo(mark, false) }, + function(mark) { vimperator.quickmarks.jumpTo(mark, false) }, { short_help: "Jump to a QuickMark in the current buffer", usage: ["go{a-zA-Z0-9}"], @@ -276,7 +278,7 @@ function Mappings() //{{{ } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["gn"], - function (mark) { vimperator.quickmarks.jumpTo(mark, true) }, + function(mark) { vimperator.quickmarks.jumpTo(mark, true) }, { short_help: "Jump to a QuickMark in a new buffer", usage: ["gn{a-zA-Z0-9}"], @@ -308,30 +310,31 @@ function Mappings() //{{{ } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ['', ''], - function (args) { - if (vimperator.tabs.getTab() == vimperator.tabs.alternate) - { - vimperator.echoerr("E23: No alternate page"); - return; - } - - // NOTE: this currently relies on v.tabs.index() returning the - // currently selected tab index when passed null - var index = vimperator.tabs.index(vimperator.tabs.alternate); - - // TODO: since a tab close is more like a bdelete for us we - // should probably reopen the closed tab when a 'deleted' - // alternate is selected - if (index == -1) - vimperator.echoerr("E86: Buffer does not exist") // TODO: This should read "Buffer N does not exist" - else - vimperator.tabs.select(index); - }, + function() + { + if (vimperator.tabs.getTab() == vimperator.tabs.alternate) { - short_help: "Select the alternate tab", - usage: [''], - help: "The alternate tab is the last selected tab. This provides a quick method of toggling between two tabs." + vimperator.echoerr("E23: No alternate page"); + return; } + + // NOTE: this currently relies on v.tabs.index() returning the + // currently selected tab index when passed null + var index = vimperator.tabs.index(vimperator.tabs.alternate); + + // TODO: since a tab close is more like a bdelete for us we + // should probably reopen the closed tab when a 'deleted' + // alternate is selected + if (index == -1) + vimperator.echoerr("E86: Buffer does not exist") // TODO: This should read "Buffer N does not exist" + else + vimperator.tabs.select(index); + }, + { + short_help: "Select the alternate tab", + usage: [''], + help: "The alternate tab is the last selected tab. This provides a quick method of toggling between two tabs." + } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["m"], function(mark) { vimperator.marks.add(mark) }, @@ -684,7 +687,7 @@ function Mappings() //{{{ /* vimperator managment */ addDefaultMap(new Map(vimperator.modes.NORMAL, [""], - function(count) { help(null); }, + function(count) { vimperator.help(null); }, { short_help: "Open help window", help: "The default section is shown, if you need help for a specific topic, try :help <F1> (jumping to a specific section not implemented yet)." diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index dffa8924..17feb424 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -112,7 +112,7 @@ function init() //{{{ if (Options.getPref("firsttime", true)) { setTimeout(function() { - help(null, null, null, { inTab: true }); + vimperator.help(null, null, null, { inTab: true }); Options.setPref("firsttime", false); }, 1000); } diff --git a/chrome/content/vimperator/vimperator.xul b/chrome/content/vimperator/vimperator.xul index 9da6d63b..10fe0551 100644 --- a/chrome/content/vimperator/vimperator.xul +++ b/chrome/content/vimperator/vimperator.xul @@ -38,8 +38,8 @@ the terms of any one of the MPL, the GPL or the LGPL. xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> -