diff --git a/chrome/content/vimperator/mappings.js b/chrome/content/vimperator/mappings.js
index 3457f752..f5679d1f 100644
--- a/chrome/content/vimperator/mappings.js
+++ b/chrome/content/vimperator/mappings.js
@@ -22,10 +22,10 @@ function Map(mode, cmd, action, extra_info)
if (extra_info.help)
this.help = extra_info.help;
- if (extra_info.short)
- this.short = extra_info.short;
+ if (extra_info.short_help)
+ this.short_help = extra_info.short_help;
- this.execute: function() {
+ this.execute = function() {
this.cmd.call(this);
}
}
@@ -35,12 +35,12 @@ function Mappings()
this.main = [];
this.user = [];
this.flags = {
- MOTION: 1 << 1;
- COUNT: 1 << 2;
- ARGUMENT: 1 << 3;
+ MOTION: 1 << 1,
+ COUNT: 1 << 2,
+ ARGUMENT: 1 << 3
};
- this.add: function(map)
+ this.add = function(map)
{
if (!map) return;
if (!this.user[map.mode])
@@ -50,7 +50,7 @@ function Mappings()
return this;
}
- this.remove: function(map)
+ this.remove = function(map)
{
var index;
@@ -61,7 +61,7 @@ function Mappings()
return this;
}
- this.get: function(mode, cmd)
+ this.get = function(mode, cmd)
{
if (!mode || !cmd) return;
var map = getFrom(mode, cmd, this.user);
@@ -89,416 +89,419 @@ function Mappings()
for (var i = 0; i < stack_length; i++)
{
for (var j = 0; j < substack[i].cmd.length; j++)
- if (substack[i].cmd[j] == cmd)
- return substack[i];
+ if (substack[i].cmd[j] == cmd)
+ return substack[i];
}
}
/* Default mappings
* Normal mode
* */
- addDefaults(new Map(vimperator.mode.NORMAL, ["]f"], focusNextFrame, {short: "Focus next frame", help:
- "Flashes the next frame in order with a red color, to quickly show where keyboard focus is.
"+
- "This may not work correctly for frames with lots of CSS code."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["b"], function (args) { vimperator.commandline.open(":", "buffer ", vimperator.modes.EX); }, {
- short: "Open a prompt to switch buffers", help:
- "Typing the corresponding number opens switches to this buffer."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["B"], toggleBufferList, {short: "Toggle buffer list", help:
- "Toggles the display of the buffer list which shows all opened tabs."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["d"], function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, false, 0); }, {
- short: "Delete current buffer (=tab)", flags: this.flags.COUNT, help:
- "Count WILL be supported in future releases, then 2d removes two tabs and the one the right is selected."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["D"], function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, true, 0); }, {
- short: "Delete current buffer (=tab)", flags: this.flags.COUNT, help:
- "Count WILL be supported in future releases, then 2d removes two tabs and the one the right is selected."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["gh"], BrowserHome, {short: "Go home", help:
- "Opens the homepage in the current tab."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["gH"], BrowserHome, {short: "Go home in a new tab", help:
- "Opens the homepage in a new tab."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["gP"], function(count) { openURLsInNewTab(readFromClipboard(), false); }, {
- short: "Open (put) an URL based on the current clipboard contents in a new buffer",
- help: "Works like P, but inverts the 'activate' setting."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["gt", "", ""],
- function(count) { vimperator.tabs.select(count > 0 ? count -1: "+1", count > 0 ? false : true); }, {
- short: "Go to the next tab", flags: this.flags.COUNT,
- help: "Cycles to the first tab, when the last is selected.
Count is supported, 3gt goes to the third tab."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["gT", "", ""],
- function(count) { vimperator.tabs.select(count > 0 ? count -1: "-1", count > 0 ? false : true); }, {
- short: "Go to the previous tab", flags: this.flags.COUNT,
- help: "Cycles to the last tab, when the first is selected.
Count is supported, 3gT goes to the third tab."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["m"], set_location_mark, {short: "Set mark at the cursor position", usage: "m{a-zA-Z}",
- help: "Marks a-z are local to the buffer, whereas A-Z are valid between buffers", flags: this.flags.ARGUMENT
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["o"], function(count) { vimperator.commandline.open(":", "open ", vimperator.modes.EX) }, {
- short: "Open one or more URLs in the current tab",
- help: "See :open for more details."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["O"],
- function(count) { vimperator.commandline.open(":", "open " + getCurrentLocation(), vimperator.modes.EX); }, {
- short: "Open one ore more URLs in the current tab, based on current location",
- help: "Works like o, but preselects current URL in the :open query."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["p", ""],
- function(count) { openURLs(readFromClipboard()); }, {
- short: "Open (put) an URL based on the current clipboard contents in the current buffer",
- help: "You can also just select some non-URL text, and search for it with the default search engine or keyword (specified by the 'defsearch' setting) with p."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["P"],
- function(count) { openURLsInNewTab(readFromClipboard(), true); }, {
- short: "Open (put) an URL based on the current clipboard contents in a new buffer",
- help: "Works like p, but opens a new tab.
" +
- "Whether the new buffer is activated, depends on the 'activate' setting."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["r"], function(count) { reload(getBrowser().mCurrentTab, false); }, {
- short: "Reload", help: "Forces reloading of the current page."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["R"], function(count) { reload(getBrowser().mCurrentTab, true); }, {
- short: "Reload while skipping the cache", help: "Forces reloading of the current page skipping the cache."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["t"], function(count) { vimperator.commandline.open(":", "tabopen ", vimperator.modes.EX); }, {
- short: "Open one or more URLs in a new tab",
- help: "Like o but open URLs in a new tab.
"+
- "See :tabopen for more details."
- }));
- addDefaults(new Map(vimperator.mode.NORMAL, ["T"],
- function(count) { vimperator.commandline.open(":", "tabopen " + getCurrentLocation(), vimperator.modes.EX); }, {
- short: "Open one ore more URLs in a new tab, based on current location",
- help: "Works like t, but preselects current URL in the :tabopen query.",
- }));
-
- var normal_maps = [
- [
- ["u"],
- ["{count}u"],
- "Undo closing of a tab",
- "If a count is given, don't close the last but the n'th last tab.",
- function(count) { execute_command(count, 'undo', false, ''); },
- this.flags.COUNT
- ],
- [
- ["y"],
- ["y"],
- "Yank current location to the clipboard",
- "Under UNIX the location is also put into the selection, which can be pasted with the middle mouse button.",
- yankCurrentLocation
- ],
- [
- ["Y"],
- ["Y"],
- "Copy selected text",
- "The currently selected text is copied to the system clipboard.",
- yankCurrentSelection,
- null
- ],
- [
- ["zi", "+"],
- ["zi", "+"],
- "Zoom in current web page by 25%",
- "Currently no count supported.",
- function(count) { zoom_in(1); }
- ],
- [
- ["zI"],
- ["zI"],
- "Zoom in current web page by 100%",
- "Currently no count supported.",
- function(count) { zoom_in(4); }
- ],
- [
- ["zo", "-"],
- ["zo", "-"],
- "Zoom out current web page by 25%",
- "Currently no count supported.",
- function(count) { zoom_in(-1); }
- ],
- [
- ["zO"],
- ["zO"],
- "Zoom out current web page by 100%",
- "Currently no count supported.",
- function(count) { zoom_in(-4); }
- ],
- [
- ["zz"],
- ["{count}zz"],
- "Set zoom value of the webpage",
- "Zoom value can be between 25 and 500%. If it is omitted, zoom is reset to 100%.",
- zoom_to,
- this.flags.COUNT
- ],
- [
- ["ZQ"],
- ["ZQ"],
- "Quit and don't save the session",
- "Works like :qall.",
- function(count) { quit(false); }
- ],
- [
- ["ZZ"],
- ["ZZ"],
- "Quit and save the session",
- "Quit Vimperator, no matter how many tabs/windows are open. The session is stored.
" +
- "Works like :xall.",
- function(count) { quit(true); }
- ],
+ addDefaults(new Map(vimperator.mode.NORMAL, ["]f"], focusNextFrame,
+ {
+ short_help: "Focus next frame",
+ help: "Flashes the next frame in order with a red color, to quickly show where keyboard focus is.
" +
+ "This may not work correctly for frames with lots of CSS code."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["b"], 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."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["B"], toggleBufferList,
+ {
+ short_help: "Toggle buffer list",
+ help: "Toggles the display of the buffer list which shows all opened tabs."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["d"], function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, false, 0); },
+ {
+ short_help: "Delete current buffer (=tab)",
+ help: "Count WILL be supported in future releases, then 2d removes two tabs and the one the right is selected.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["D"], function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, true, 0); },
+ {
+ short_help: "Delete current buffer (=tab)",
+ help: "Count WILL be supported in future releases, then 2d removes two tabs and the one the right is selected.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["gh"], BrowserHome,
+ {
+ short_help: "Go home",
+ help: "Opens the homepage in the current tab."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["gH"], BrowserHome,
+ {
+ short_help: "Go home in a new tab",
+ help: "Opens the homepage in a new tab."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["gP"], function(count) { openURLsInNewTab(readFromClipboard(), false); },
+ {
+ short_help: "Open (put) an URL based on the current clipboard contents in a new buffer",
+ help: "Works like P, but inverts the 'activate' setting."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["gt", "", ""], function(count) { vimperator.tabs.select(count > 0 ? count -1: "+1", count > 0 ? false : true); },
+ {
+ short_help: "Go to the next tab",
+ help: "Cycles to the first tab, when the last is selected.
Count is supported, 3gt goes to the third tab.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["gT", "", ""], function(count) { vimperator.tabs.select(count > 0 ? count -1: "-1", count > 0 ? false : true); },
+ {
+ short_help: "Go to the previous tab",
+ help: "Cycles to the last tab, when the first is selected.
Count is supported, 3gT goes to the third tab.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["m"], set_location_mark,
+ {
+ short_help: "Set mark at the cursor position", usage: "m{a-zA-Z}",
+ help: "Marks a-z are local to the buffer, whereas A-Z are valid between buffers",
+ flags: this.flags.ARGUMENT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["o"], function(count) { vimperator.commandline.open(":", "open ", vimperator.modes.EX); },
+ {
+ short_help: "Open one or more URLs in the current tab",
+ help: "See :open for more details."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["O"], function(count) { vimperator.commandline.open(":", "open " + getCurrentLocation(), vimperator.modes.EX); },
+ {
+ short_help: "Open one ore more URLs in the current tab, based on current location",
+ help: "Works like o, but preselects current URL in the :open query."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["p", ""], function(count) { openURLs(readFromClipboard()); },
+ {
+ short_help: "Open (put) an URL based on the current clipboard contents in the current buffer",
+ help: "You can also just select some non-URL text, and search for it with the default search engine or keyword (specified by the 'defsearch' setting) with p."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["P"], function(count) { openURLsInNewTab(readFromClipboard(), true); },
+ {
+ short_help: "Open (put) an URL based on the current clipboard contents in a new buffer",
+ help: "Works like p, but opens a new tab.
" +
+ "Whether the new buffer is activated, depends on the 'activate' setting."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["r"], function(count) { reload(getBrowser().mCurrentTab, false); },
+ {
+ short_help: "Reload",
+ help: "Forces reloading of the current page."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["R"], function(count) { reload(getBrowser().mCurrentTab, true); },
+ {
+ short_help: "Reload while skipping the cache",
+ help: "Forces reloading of the current page skipping the cache."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["t"], function(count) { vimperator.commandline.open(":", "tabopen ", vimperator.modes.EX); },
+ {
+ short_help: "Open one or more URLs in a new tab",
+ help: "Like o but open URLs in a new tab.
" +
+ "See :tabopen for more details."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["T"], function(count) { vimperator.commandline.open(":", "tabopen " + getCurrentLocation(), vimperator.modes.EX); },
+ {
+ short_help: "Open one ore more URLs in a new tab, based on current location",
+ help: "Works like t, but preselects current URL in the :tabopen query."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["u"], function(count) { execute_command(count, 'undo', false, ''); },
+ {
+ short_help: "Undo closing of a tab",
+ help: "If a count is given, don't close the last but the n'th last tab.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["y"], yankCurrentLocation,
+ {
+ short_help: "Yank current location to the clipboard",
+ help: "Under UNIX the location is also put into the selection, which can be pasted with the middle mouse button."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["Y"], yankCurrentSelection,
+ {
+ short_help: "Copy selected text",
+ help: "The currently selected text is copied to the system clipboard."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["zi", "+"], function(count) { zoom_in(1); },
+ {
+ short_help: "Zoom in current web page by 25%",
+ help: "Currently no count supported."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["zI"], function(count) { zoom_in(4); },
+ {
+ short_help: "Zoom in current web page by 100%",
+ help: "Currently no count supported."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["zo", "-"], function(count) { zoom_in(-1); },
+ {
+ short_help: "Zoom out current web page by 25%",
+ help: "Currently no count supported."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["zO"], function(count) { zoom_in(-4); },
+ {
+ short_help: "Zoom out current web page by 100%",
+ help: "Currently no count supported."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["zz"], zoom_to,
+ {
+ short_help: "Set zoom value of the webpage",
+ help: "Zoom value can be between 25 and 500%. If it is omitted, zoom is reset to 100%.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["ZQ"], function(count) { quit(false); },
+ {
+ short_help: "Quit and don't save the session",
+ help: "Works like :qall."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["ZZ"], function(count) { quit(true); },
+ {
+ short_help: "Quit and save the session",
+ help: "Quit Vimperator, no matter how many tabs/windows are open. The session is stored.
" + "Works like :xall."
+ }
+ ));
/* scrolling commands */
- [
- ["0", "^"],
- ["0", "^"],
- "Scroll to the absolute left of the document",
- "Unlike in vim, 0 and ^ work exactly the same way.",
- function(count) { scrollBufferAbsolute(0, -1); }
- ],
- [
- ["$"],
- ["$"],
- "Scroll to the absolute right of the document",
- null,
- function(count) { scrollBufferAbsolute(100, -1); }
- ],
- [
- ["gg", ""],
- ["{count}gg", "{count}"],
- "Goto the top of the document",
- "Count is supported, 35gg vertically goes to 35% of the document.",
- function(count) { scrollBufferAbsolute(-1, count > 0 ? count : 0); },
- this.flags.COUNT
- ],
- [
- ["G", ""],
- ["{count}G", "{count}"],
- "Goto the end of the document",
- "Count is supported, 35G vertically goes to 35% of the document.",
- function(count) { scrollBufferAbsolute(-1, count >= 0 ? count : 100); },
- this.flags.COUNT
- ],
- [
- ["h", ""],
- ["{count}h", "{count}"],
- "Scroll document to the left",
- "Count is supported: 10h will move 10 times as much to the left.
"+
- "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).",
- function(count) { scrollBufferRelative(-1, 0); },
- this.flags.COUNT
- ],
- [
- ["j", "", ""],
- ["{count}j", "{count}", "{count}"],
- "Scroll document down",
- "Count is supported: 10j will move 10 times as much down.
"+
- "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).",
- function(count) { scrollBufferRelative(0, 1); },
- this.flags.COUNT
- ],
- [
- ["k", "", ""],
- ["{count}k", "{count}", "{count}"],
- "Scroll document up",
- "Count is supported: 10k will move 10 times as much up.
"+
- "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).",
- function(count) { scrollBufferRelative(0, -1); },
- this.flags.COUNT
- ],
- [
- ["l", ""],
- ["{count}l", "{count}"],
- "Scroll document to the right",
- "Count is supported: 10l will move 10 times as much to the right.
"+
- "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).",
- function(count) { scrollBufferRelative(1, 0); },
- this.flags.COUNT
- ],
- [
- ["", "", "", ""],
- [""],
- "Scroll up a full page of the current document",
- "No count support for now.",
- function(count) { goDoCommand('cmd_scrollPageUp'); }
- ],
- [
- ["", "", "", ""],
- [""],
- "Scroll down a full page of the current document",
- "No count support for now,",
- function(count) { goDoCommand('cmd_scrollPageDown'); }
- ],
+ addDefaults(new Map(vimperator.mode.NORMAL, ["0", "^"], function(count) { scrollBufferAbsolute(0, -1); },
+ {
+ short_help: "Scroll to the absolute left of the document",
+ help: "Unlike in vim, 0 and ^ work exactly the same way."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["$"], function(count) { scrollBufferAbsolute(100, -1); },
+ {
+ short_help: "Scroll to the absolute right of the document",
+ help: null
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["gg", ""], function(count) { scrollBufferAbsolute(-1, count > 0 ? count : 0); },
+ {
+ short_help: "Goto the top of the document",
+ help: "Count is supported, 35gg vertically goes to 35% of the document.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["G", ""], function(count) { scrollBufferAbsolute(-1, count >= 0 ? count : 100); },
+ {
+ short_help: "Goto the end of the document",
+ help: "Count is supported, 35G vertically goes to 35% of the document.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["h", ""], function(count) { scrollBufferRelative(-1, 0); },
+ {
+ short_help: "Scroll document to the left",
+ help: "Count is supported: 10h will move 10 times as much to the left.
" +
+ "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["j", "", ""], function(count) { scrollBufferRelative(0, 1); },
+ {
+ short_help: "Scroll document down",
+ help: "Count is supported: 10j will move 10 times as much down.
" +
+ "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["k", "", ""], function(count) { scrollBufferRelative(0, -1); },
+ {
+ short_help: "Scroll document up",
+ help: "Count is supported: 10k will move 10 times as much up.
" +
+ "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["l", ""], function(count) { scrollBufferRelative(1, 0); },
+ {
+ short_help: "Scroll document to the right",
+ help: "Count is supported: 10l will move 10 times as much to the right.
" +
+ "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["", "", "", ""], function(count) { goDoCommand('cmd_scrollPageUp'); },
+ {
+ short_help: "Scroll up a full page of the current document",
+ help: "No count support for now."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["", "", "", ""], function(count) { goDoCommand('cmd_scrollPageDown'); },
+ {
+ short_help: "Scroll down a full page of the current document",
+ help: "No count support for now,"
+ }
+ ));
/* history manipulation and jumplist */
- [
- [""],
- ["{count}"],
- "Go to an older position in the jump list",
- "The jump list is just the browser history for now",
- function(count) { stepInHistory(count > 0 ? -1 * count : -1); },
- this.flags.COUNT
- ],
- [
- [""],
- ["{count}"],
- "Go to a newer position in the jump list",
- "The jump list is just the browser history for now",
- function(count) { stepInHistory(count > 0 ? count : 1); },
- this.flags.COUNT
- ],
- [
- ["H", "", ""],
- ["{count}H", "{count}", "{count}"],
- "Go back in the browser history",
- "Count is supported, 3H goes back 3 steps.",
- function(count) { stepInHistory(count > 0 ? -1 * count : -1); },
- this.flags.COUNT
- ],
- [
- ["L", "", ""],
- ["{count}L", "{count}", "{count}"],
- "Go forward in the browser history",
- "Count is supported, 3L goes forward 3 steps.",
- function(count) { stepInHistory(count > 0 ? count : 1); },
- this.flags.COUNT
- ],
- [
- ["gu", ""],
- ["{count}gu", "{count}"],
- "Go to parent directory",
- "Count is supported, 2gu on http://www.example.com/dir1/dir2/file.htm would open http://www.example.com/dir1/.",
- goUp,
- this.flags.COUNT
- ],
- [
- ["gU", ""],
- ["gU", ""],
- "Go to the root of the website",
- "gU on http://www.example.com/dir1/dir2/file.htm opens http://www.example.com/.
"+
- "When browsing a local directory, it goes to the root document.",
- function(count) { openURLs("..."); }
- ],
+ addDefaults(new Map(vimperator.mode.NORMAL, [""], function(count) { stepInHistory(count > 0 ? -1 * count : -1); },
+ {
+ short_help: "Go to an older position in the jump list",
+ help: "The jump list is just the browser history for now",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, [""], function(count) { stepInHistory(count > 0 ? count : 1); },
+ {
+ short_help: "Go to a newer position in the jump list",
+ help: "The jump list is just the browser history for now",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["H", "", ""], function(count) { stepInHistory(count > 0 ? -1 * count : -1); },
+ {
+ short_help: "Go back in the browser history",
+ help: "Count is supported, 3H goes back 3 steps.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["L", "", ""], function(count) { stepInHistory(count > 0 ? count : 1); },
+ {
+ short_help: "Go forward in the browser history",
+ help: "Count is supported, 3L goes forward 3 steps.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["gu", ""], goUp,
+ {
+ short_help: "Go to parent directory",
+ help: "Count is supported, 2gu on http://www.example.com/dir1/dir2/file.htm would open http://www.example.com/dir1/.",
+ flags: this.flags.COUNT
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["gU", ""], function(count) { openURLs("..."); },
+ {
+ short_help: "Go to the root of the website",
+ help: "gU on http://www.example.com/dir1/dir2/file.htm opens http://www.example.com/.
" +
+ "When browsing a local directory, it goes to the root document."
+ }
+ ));
/* hint managment */
- [
- ["f"],
- ["f"],
- "Start QuickHint mode",
- "In QuickHint mode, every hintable item (according to the 'hinttags' XPath query) is assigned a label.
"+
- "If you then press the keys for a label, it is followed as soon as it can be uniquely identified and this mode is stopped. Or press <Esc> to stop this mode.
"+
- "If you write the hint in ALLCAPS, the hint is followed in a background tab.",
- function(count) { hah.enableHahMode(vimperator.modes.QUICK_HINT); }
- ],
- [
- ["F"],
- ["F"],
- "Start AlwaysHint mode",
- "In AlwaysHint mode, every hintable item (according to the 'hinttags' XPath query) is assigned a label.
"+
- "If you then press the keys for a label, it is followed as soon as it can be uniquely identified. Labels stay active after following a hint in this mode, press <Esc> to stop this mode.
"+
- "This hint mode is especially useful for browsing large sites like Forums as hints are automatically regenerated when switching to a new document.
"+
- "Also, most Ctrl-prefixed shortcut keys are available in this mode for navigation.",
- function(count) { hah.enableHahMode(vimperator.modes.ALWAYS_HINT); }
- ],
- [
- [";"],
- [";"],
- "Start ExtendedHint mode",
- "ExtendedHint mode is useful, since in this mode you can yank link locations, or open them in a new window.
"+
- "E.g., if you want to yank the location of hint AB, press ; to start this hint mode.
"+
- "Then press AB to select the hint. Now press y to yank its location.
"+
- "Actions for selected hints in ExtendedHint mode are:
"+
- "y to yank its location "+
- " Y to yank its text description "+
- " o to open its location in the current tab "+
- " t to open its location in a new tab "+
- " O to open its location in an :open query (not implemented yet) "+
- " T to open its location in an :tabopen query (not implemented yet) "+
- " s to save its destination (not implemented yet) "+
- " <C-w> to open its destination in a new window "+
- "
"+
- "Multiple hints can be seperated by commas where it makes sense. ;ab,ac,adt opens AB, AC and AD in a new tab.
"+
- "Hintable elements for this mode can be set in the 'extendedhinttags' XPath string.",
- function(count) { hah.enableHahMode(vimperator.modes.EXTENDED_HINT); }
- ],
+ addDefaults(new Map(vimperator.mode.NORMAL, ["f"], function(count) { hah.enableHahMode(vimperator.modes.QUICK_HINT); },
+ {
+ short_help: "Start QuickHint mode",
+ help: "In QuickHint mode, every hintable item (according to the 'hinttags' XPath query) is assigned a label.
" +
+ "If you then press the keys for a label, it is followed as soon as it can be uniquely identified and this mode is stopped. Or press <Esc> to stop this mode.
" +
+ "If you write the hint in ALLCAPS, the hint is followed in a background tab."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["F"], function(count) { hah.enableHahMode(vimperator.modes.ALWAYS_HINT); },
+ {
+ short_help: "Start AlwaysHint mode",
+ help: "In AlwaysHint mode, every hintable item (according to the 'hinttags' XPath query) is assigned a label.
" +
+ "If you then press the keys for a label, it is followed as soon as it can be uniquely identified. Labels stay active after following a hint in this mode, press <Esc> to stop this mode.
" +
+ "This hint mode is especially useful for browsing large sites like Forums as hints are automatically regenerated when switching to a new document.
" +
+ "Also, most Ctrl-prefixed short_helpcut keys are available in this mode for navigation."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, [";"], function(count) { hah.enableHahMode(vimperator.modes.EXTENDED_HINT); },
+ {
+ short_help: "Start ExtendedHint mode",
+ help: "ExtendedHint mode is useful, since in this mode you can yank link locations, or open them in a new window.
" +
+ "E.g., if you want to yank the location of hint AB, press ; to start this hint mode.
" +
+ "Then press AB to select the hint. Now press y to yank its location.
" +
+ "Actions for selected hints in ExtendedHint mode are:
" +
+ "y to yank its location " +
+ " Y to yank its text description " +
+ " o to open its location in the current tab " +
+ " t to open its location in a new tab " +
+ " O to open its location in an :open query (not implemented yet) " +
+ " T to open its location in an :tabopen query (not implemented yet) " +
+ " s to save its destination (not implemented yet) " +
+ " <C-w> to open its destination in a new window " +
+ "
" +
+ "Multiple hints can be seperated by commas where it makes sense. ;ab,ac,adt opens AB, AC and AD in a new tab.
" +
+ "Hintable elements for this mode can be set in the 'extendedhinttags' XPath string."
+ }
+ ));
/* search managment */
- [
- ["g/"],
- ["g/"],
- "Search forward for a pattern",
- "",
- function(count) { vimperator.search.openSearchDialog(); }
- ],
- [
- ["n"],
- ["n"],
- "Find next",
- "Repeat the last \"/\" 1 time (until count is supported).",
- function(count) { vimperator.search.findNext(); }
- ],
- [
- ["N"],
- ["N"],
- "Find previous",
- "Repeat the last \"/\" 1 time (until count is supported) in the opposite direction.",
- function(count) { vimperator.search.findPrevious(); }
- ],
+ addDefaults(new Map(vimperator.mode.NORMAL, ["g/"], function(count) { vimperator.search.openSearchDialog(); },
+ {
+ short_help: "Search forward for a pattern",
+ help: ""
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["n"], function(count) { vimperator.search.findNext(); },
+ {
+ short_help: "Find next",
+ help: "Repeat the last \"/\" 1 time (until count is supported)."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["N"], function(count) { vimperator.search.findPrevious(); },
+ {
+ short_help: "Find previous",
+ help: "Repeat the last \"/\" 1 time (until count is supported) in the opposite direction."
+ }
+ ));
/* vimperator managment */
- [
- [""],
- [""],
- "Open help window",
- "The default section is shown, if you need help for a specific topic, try :help <F1> (jumping to a specific section not implemented yet).",
- function(count) { help(null); }
- ],
- [
- [":"],
- [":"],
- "Start command line mode",
- "In command line mode, you can perform extended commands, which may require arguments.",
- function(count) { vimperator.commandline.open(":", "", vimperator.modes.EX); }
- ],
- [
- ["I"],
- ["I"],
- "Disable vimperator keys",
- "Starts an 'ignorekeys' mode, where all keys except <Esc> are passed to the next event handler.
"+
- "This is especially useful, if JavaScript controlled forms like the RichEdit form fields of GMail don't work anymore.
" +
- "To exit this mode, press <Esc>. If you also need to pass <Esc>"+
- "in this mode to the webpage, prepend it with <C-v>.",
- function(count) { vimperator.addMode(null, vimperator.modes.ESCAPE_ALL_KEYS);}
- ],
- [
- [""], // if you ever add/remove keys here, also check them in the onVimperatorKeypress() function
- [""],
- "Escape next key",
- "If you need to pass a certain key to a javascript form field or another extension prefix the key with <C-v>.
"+
- "Also works to unshadow Firefox shortcuts like <C-o> which are otherwise hidden in Vimperator.
"+
- "When in 'ignorekeys' mode (activated by <I>), <C-v> will pass the next key to Vimperator instead of the webpage.",
- function(count) { vimperator.addMode(null, vimperator.modes.ESCAPE_ONE_KEY); }
- ],
- [
- [""],
- [""],
- "Stop loading",
- "Stops loading the current webpage.",
- BrowserStop
- ],
- [
- ["", ""], // if you ever add/remove keys here, also check them in the onVimperatorKeypress() function
- ["", ""],
- "Cancel any operation",
- "Exits any command line or hint mode and returns to browser mode.
"+
- "Also focuses the web page, in case a form field has focus and eats our key presses.",
- onEscape
- ]
- ];
+ addDefaults(new Map(vimperator.mode.NORMAL, [""], function(count) { 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)."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, [":"], function(count) { vimperator.commandline.open(":", "", vimperator.modes.EX); },
+ {
+ short_help: "Start command line mode",
+ help: "In command line mode, you can perform extended commands, which may require arguments."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, ["I"], function(count) { vimperator.addMode(null, vimperator.modes.ESCAPE_ALL_KEYS);},
+ {
+ short_help: "Disable vimperator keys",
+ help: "Starts an 'ignorekeys' mode, where all keys except <Esc> are passed to the next event handler.
" +
+ "This is especially useful, if JavaScript controlled forms like the RichEdit form fields of GMail don't work anymore.
" +
+ "To exit this mode, press <Esc>. If you also need to pass <Esc>" +
+ "in this mode to the webpage, prepend it with <C-v>."
+ }
+ ));
+ // if you ever add/remove keys here, also check them in the onVimperatorKeypress() function
+ addDefaults(new Map(vimperator.mode.NORMAL, [""], function(count) { vimperator.addMode(null, vimperator.modes.ESCAPE_ONE_KEY); },
+ {
+ short_help: "Escape next key",
+ help: "If you need to pass a certain key to a javascript form field or another extension prefix the key with <C-v>.
" +
+ "Also works to unshadow Firefox short_helpcuts like <C-o> which are otherwise hidden in Vimperator.
" +
+ "When in 'ignorekeys' mode (activated by <I>), <C-v> will pass the next key to Vimperator instead of the webpage."
+ }
+ ));
+ addDefaults(new Map(vimperator.mode.NORMAL, [""], BrowserStop,
+ {
+ short_help: "Stop loading",
+ help: "Stops loading the current webpage."
+ }
+ ));
+ // if you ever add/remove keys here, also check them in the onVimperatorKeypress()
+ addDefaults(new Map(vimperator.mode.NORMAL, ["", ""], onEscape,
+ {
+ short_help: "Cancel any operation",
+ help: "Exits any command line or hint mode and returns to browser mode.
"
+ }
+ ));
+
var hint_maps = [
/* hint action keys */
["o", "hah.openHints(false, false);", true, false],