1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 18:27:57 +01:00

merged the new mappings code, all glory goes to Doug!

This commit is contained in:
Martin Stubenschrott
2007-05-31 09:11:24 +00:00
parent 4406c23944
commit b51357109d
6 changed files with 98 additions and 610 deletions

View File

@@ -511,538 +511,6 @@ var g_commands = [/*{{{*/
]
];/*}}}*/
/* all built-in normal mode commands of Vimperator
* format:
* [
* 0: [all shortcuts of this command],
* 1: usage,
* 2: shorthelp
* 3: helptext
* 4: function (arguments in this order: args, special, count)
* ]
*/
var g_mappings = [/*{{{*/
[
["]f"],
["]f"],
"Focus next frame",
"Flashes the next frame in order with a red color, to quickly show where keyboard focus is.<br/>"+
"This may not work correctly for frames with lots of CSS code.",
focusNextFrame
],
[
["b"],
["b {number}"],
"Open a prompt to switch buffers",
"Typing the corresponding number opens switches to this buffer.",
function (args) { vimperator.commandline.open(":", "buffer ", vimperator.modes.EX); }
],
[
["B"],
["B"],
"Toggle buffer list",
"Toggles the display of the buffer list which shows all opened tabs.",
toggleBufferList
],
[
["d"],
["{count}d"],
"Delete current buffer (=tab)",
"Count WILL be supported in future releases, then <code class=\"mapping\">2d</code> removes two tabs and the one the right is selected.",
function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, false, 0); }
],
[
["D"],
["{count}D"],
"Delete current buffer (=tab)",
"Count WILL be supported in future releases, then <code class=\"mapping\">2D</code> removes two tabs and the one the left is selected.",
function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, true, 0); }
],
/*[
["ge"],
["ge {cmd}"],
"Execute an Ex command",
"<code>Go Execute</code> works like <code class=\"command\">:execute</code>.<br/>"+
"This mapping is for debugging purposes, and may be removed in future.",
function(count) { openVimperatorBar('execute '); }
],*/
[
["gh"],
["gh"],
"Go home",
"Opens the homepage in the current tab.",
BrowserHome
],
[
["gH"],
["gH"],
"Go home in a new tab",
"Opens the homepage in a new tab.",
function(count) { openURLsInNewTab("", true); BrowserHome(); }
],
[
["gP"],
["gP"],
"Open (put) an URL based on the current clipboard contents in a new buffer",
"Works like <code class=\"mapping\">P</code>, but inverts the <code class=\"setting\">'activate'</code> setting.",
function(count) { openURLsInNewTab(readFromClipboard(), false); }
],
[
["gt", "<C-n>", "<C-Tab>"],
["{count}gt"],
"Go to next tab",
"Cycles to the first tab, when the last is selected.<br/>"+
"Count is supported, <code class=\"mapping\">3gt</code> goes to the third tab.",
function(count) { vimperator.tabs.select(count > 0 ? count -1: "+1", count > 0 ? false : true); }
],
[
["gT", "<C-p>", "<C-S-Tab>"],
["{count}gT"],
"Go to previous tab",
"Cycles to the last tab, when the first is selected.<br/>"+
"Count is supported, <code class=\"mapping\">3gt</code> goes to the third tab.",
function(count) { vimperator.tabs.select(count > 0 ? count -1: "-1", count > 0 ? false : true); }
],
[
["o"],
["o"],
"Open one or more URLs in the current tab",
"See <code class=\"command\">:open</code> for more details.",
function(count) { vimperator.commandline.open(":", "open ", vimperator.modes.EX); }
],
[
["O"],
["O"],
"Open one ore more URLs in the current tab, based on current location",
"Works like <code class=\"mapping\">o</code>, but preselects current URL in the <code class=\"command\">:open</code> query.",
function(count) { vimperator.commandline.open(":", "open " + getCurrentLocation(), vimperator.modes.EX); }
],
[
["p", "<MiddleMouse>"],
["p", "<MiddleMouse>"],
"Open (put) an URL based on the current clipboard contents in the current buffer",
"You can also just select some non-URL text, and search for it with the default search engine or keyword (specified by the <code class=\"setting\">'defsearch'</code> setting) with <code class=\"mapping\">p</code>.",
function(count) { openURLs(readFromClipboard()); }
],
[
["P"],
["P"],
"Open (put) an URL based on the current clipboard contents in a new buffer",
"Works like <code class=\"mapping\">p</code>, but opens a new tab.<br/>"+
"Whether the new buffer is activated, depends on the <code class=\"setting\">'activate'</code> setting.",
function(count) { openURLsInNewTab(readFromClipboard(), true); }
],
[
["r"],
["r"],
"Reload",
"Forces reloading of the current page.",
function(count) { reload(getBrowser().mCurrentTab, false); }
],
[
["R"],
["R"],
"Reload skipping the cache",
"Forces reloading of the current page skipping the cache.",
function(count) { reload(getBrowser().mCurrentTab, true); }
],
[
["t"],
["t"],
"Open one or more URLs in a new tab",
"Like <code class=\"mapping\">o</code> but open URLs in a new tab.<br/>"+
"See <code class=\"command\">:tabopen</code> for more details.",
function(count) { vimperator.commandline.open(":", "tabopen ", vimperator.modes.EX); }
],
[
["T"],
["T"],
"Open one ore more URLs in a new tab, based on current location",
"Works like <code class=\"mapping\">t</code>, but preselects current URL in the <code class=\"command\">:tabopen</code> query.",
function(count) { vimperator.commandline.open(":", "tabopen " + getCurrentLocation(), vimperator.modes.EX); }
],
[
["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, ''); }
],
[
["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
],
[
["ZQ"],
["ZQ"],
"Quit and don't save the session",
"Works like <code class=\"command\">:qall</code>.",
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.<br/>" +
"Works like <code class=\"command\">:xall</code>.",
function(count) { quit(true); }
],
/* scrolling commands */
[
["0", "^"],
["0", "^"],
"Scroll to the absolute left of the document",
"Unlike in vim, <code class=\"mapping\">0</code> and <code class=\"mapping\">^</code> 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", "<Home>"],
["{count}gg", "{count}<Home>"],
"Goto the top of the document",
"Count is supported, <code class=\"mapping\">35gg</code> vertically goes to 35% of the document.",
function(count) { scrollBufferAbsolute(-1, count > 0 ? count : 0); }
],
[
["G", "<End>"],
["{count}G", "{count}<End>"],
"Goto the end of the document",
"Count is supported, <code class=\"mapping\">35G</code> vertically goes to 35% of the document.",
function(count) { scrollBufferAbsolute(-1, count >= 0 ? count : 100); }
],
[
["h", "<Left>"],
["{count}h", "{count}<Left>"],
"Scroll document to the left",
"Count is supported: <code class=\"mapping\">10h</code> will move 10 times as much to the left.<br/>"+
"If the document cannot scroll more, a beep is emmited (unless <code class=\"setting\">'beep'</code> is turned off).",
function(count) { scrollBufferRelative(-1, 0); }
],
[
["j", "<Down>", "<C-e>"],
["{count}j", "{count}<Down>", "{count}<C-e>"],
"Scroll document down",
"Count is supported: <code class=\"mapping\">10j</code> will move 10 times as much down.<br/>"+
"If the document cannot scroll more, a beep is emmited (unless <code class=\"setting\">'beep'</code> is turned off).",
function(count) { scrollBufferRelative(0, 1); }
],
[
["k", "<Up>", "<C-y>"],
["{count}k", "{count}<Up>", "{count}<C-y>"],
"Scroll document up",
"Count is supported: <code class=\"mapping\">10k</code> will move 10 times as much up.<br/>"+
"If the document cannot scroll more, a beep is emmited (unless <code class=\"setting\">'beep'</code> is turned off).",
function(count) { scrollBufferRelative(0, -1); }
],
[
["l", "<Right>"],
["{count}l", "{count}<Right>"],
"Scroll document to the right",
"Count is supported: <code class=\"mapping\">10l</code> will move 10 times as much to the right.<br/>"+
"If the document cannot scroll more, a beep is emmited (unless <code class=\"setting\">'beep'</code> is turned off).",
function(count) { scrollBufferRelative(1, 0); }
],
[
["<C-b>", "<C-u>", "<PageUp>", "<S-Space>"],
["<C-b>"],
"Scroll up a full page of the current document",
"No count support for now.",
function(count) { goDoCommand('cmd_scrollPageUp'); }
],
[
["<C-f>", "<C-d>", "<PageDown>", "<Space>"],
["<C-f>"],
"Scroll down a full page of the current document",
"No count support for now,",
function(count) { goDoCommand('cmd_scrollPageDown'); }
],
/* history manipulation and jumplist */
[
["<C-o>"],
["{count}<C-o>"],
"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); }
],
[
["<C-i>"],
["{count}<C-i>"],
"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); }
],
[
["H", "<A-Left>", "<M-Left>"],
["{count}H", "{count}<A-Left>", "{count}<M-Left>"],
"Go back in the browser history",
"Count is supported, <code class=\"mapping\">3H</code> goes back 3 steps.",
function(count) { stepInHistory(count > 0 ? -1 * count : -1); }
],
[
["L", "<A-Right>", "<M-Right>"],
["{count}L", "{count}<A-Right>", "{count}<M-Right>"],
"Go forward in the browser history",
"Count is supported, <code class=\"mapping\">3L</code> goes forward 3 steps.",
function(count) { stepInHistory(count > 0 ? count : 1); }
],
[
["gu", "<BS>"],
["{count}gu", "{count}<BS>"],
"Go to parent directory",
"Count is supported, <code class=\"mapping\">2gu</code> on <code>http://www.example.com/dir1/dir2/file.htm</code> would open <code>http://www.example.com/dir1/</code>.",
goUp
],
[
["gU", "<C-BS>"],
["gU", "<C-BS>"],
"Go to the root of the website",
"<code class=\"mapping\">gU</code> on <code>http://www.example.com/dir1/dir2/file.htm</code> opens <code>http://www.example.com/</code>.<br/>"+
"When browsing a local directory, it goes to the root document.",
function(count) { openURLs("..."); }
],
/* hint managment */
[
["f"],
["f"],
"Start QuickHint mode",
"In QuickHint mode, every hintable item (according to the <code class=\"setting\">'hinttags'</code> XPath query) is assigned a label.<br/>"+
"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 <code class=\"mapping\">&lt;Esc&gt;</code> to stop this mode.<br/>"+
"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 <code class=\"setting\">'hinttags'</code> XPath query) is assigned a label.<br/>"+
"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 <code class=\"mapping\">&lt;Esc&gt;</code> to stop this mode.<br/>"+
"This hint mode is especially useful for browsing large sites like Forums as hints are automatically regenerated when switching to a new document.<br/>"+
"Also, most <code class=\"mapping\">Ctrl</code>-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.<br/>"+
"E.g., if you want to yank the location of hint <code>AB</code>, press <code class=\"mapping\">;</code> to start this hint mode.<br/>"+
"Then press <code>AB</code> to select the hint. Now press <code class=\"mapping\">y</code> to yank its location.<br/>"+
"Actions for selected hints in ExtendedHint mode are:<br/>"+
"<ul><li><code class=\"mapping\">y</code> to yank its location</li>"+
" <li><code class=\"mapping\">Y</code> to yank its text description</li>"+
" <li><code class=\"mapping\">o</code> to open its location in the current tab</li>"+
" <li><code class=\"mapping\">t</code> to open its location in a new tab</li>"+
" <li><code class=\"mapping\">O</code> to open its location in an <code class=\"command\">:open</code> query (not implemented yet)</li>"+
" <li><code class=\"mapping\">T</code> to open its location in an <code class=\"command\">:tabopen</code> query (not implemented yet)</li>"+
" <li><code class=\"mapping\">s</code> to save its destination (not implemented yet)</li>"+
" <li><code class=\"mapping\">&lt;C-w&gt;</code> to open its destination in a new window</li>"+
"</ul>"+
"Multiple hints can be seperated by commas where it makes sense. <code class=\"mapping\">;ab,ac,adt</code> opens <code>AB</code>, <code>AC</code> and <code>AD</code> in a new tab.<br/>"+
"Hintable elements for this mode can be set in the <code class=\"setting\">'extendedhinttags'</code> XPath string.",
function(count) { hah.enableHahMode(vimperator.modes.EXTENDED_HINT); }
],
/* search managment */
[
["g/"],
["g/"],
"Open search dialog",
"",
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(); }
],
/* vimperator managment */
[
["<F1>"],
["<F1>"],
"Open help window",
"The default section is shown, if you need help for a specific topic, try <code class=\"command\">:help &lt;F1&gt;</code> (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 <code class=\"mapping\">&lt;Esc&gt;</code> are passed to the next event handler.<br/>"+
"This is especially useful, if JavaScript controlled forms like the RichEdit form fields of GMail don't work anymore.<br/>" +
"To exit this mode, press <code class=\"mapping\">&lt;Esc&gt;</code>. If you also need to pass <code class=\"mapping\">&lt;Esc&gt;</code>"+
"in this mode to the webpage, prepend it with <code class=\"mapping\">&lt;C-v&gt;</code>.",
function(count) { vimperator.addMode(null, vimperator.modes.ESCAPE_ALL_KEYS);}
],
[
["<C-v>"], // if you ever add/remove keys here, also check them in the onVimperatorKeypress() function
["<C-v>"],
"Escape next key",
"If you need to pass a certain key to a javascript form field or another extension prefix the key with <code class=\"mapping\">&lt;C-v&gt;</code>.<br/>"+
"Also works to unshadow Firefox shortcuts like <code class=\"mapping\">&lt;C-o&gt;</code> which are otherwise hidden in Vimperator.<br/>"+
"When in 'ignorekeys' mode (activated by <code class=\"mapping\">&lt;I&gt;</code>), <code class=\"mapping\">&lt;C-v&gt;</code> will pass the next key to Vimperator instead of the webpage.",
function(count) { vimperator.addMode(null, vimperator.modes.ESCAPE_ONE_KEY); }
],
[
["<C-c>"],
["<C-c>"],
"Stop loading",
"Stops loading the current webpage.",
BrowserStop,
],
[
["<Esc>", "<C-[>"], // if you ever add/remove keys here, also check them in the onVimperatorKeypress() function
["<Esc>", "<C-[>"],
"Cancel any operation",
"Exits any command line or hint mode and returns to browser mode.<br/>"+
"Also focuses the web page, in case a form field has focus and eats our key presses.",
onEscape
],
/* quick bookmark access - will be customizable in future*/
[
["'b"],
["'b"],
"These quick bookmarks will be customizable in future releases, ignore for now",
null,
function(count) { openURLs('www.bwin.com'); }
],
[
["'o"],
["'o"],
"These quick bookmarks will be customizable in future releases, ignore for now",
null,
function(count) { openURLs('www.osnews.com'); }
],
[
["'s"],
["'s"],
"These quick bookmarks will be customizable in future releases, ignore for now<br/>",
null,
function(count) { openURLs('www.derstandard.at'); }
],
[
["'w"],
["'w"],
"These quick bookmarks will be customizable in future releases, ignore for now<br/>",
null,
function(count) { openURLs('wetter.orf.at'); }
],
[
["'t"],
["'t"],
"These quick bookmarks will be customizable in future releases, ignore for now<br/>",
null,
function(count) { openURLs('www.tvinfo.de'); }
],
[
["\"b"],
["\"b"],
"These quick bookmarks will be customizable in future releases, ignore for now<br/>",
null,
function(count) { openURLsInNewTab('www.bwin.com'); }
],
[
["\"o"],
["\"o"],
"These quick bookmarks will be customizable in future releases, ignore for now<br/>",
null,
function(count) { openURLsInNewTab('www.osnews.com'); }
],
[
["\"s"],
["\"s"],
"These quick bookmarks will be customizable in future releases, ignore for now<br/>",
null,
function(count) { openURLsInNewTab('www.derstandard.at'); }
],
[
["\"w"],
["\"w"],
"These quick bookmarks will be customizable in future releases, ignore for now<br/>",
null,
function(count) { openURLsInNewTab('wetter.orf.at'); }
],
[
["\"t"],
["\"t"],
"These quick bookmarks will be customizable in future releases, ignore for now<br/>",
null,
function(count) { openURLsInNewTab('www.tvinfo.de'); }
]
];/*}}}*/
// var g_insert_mappings = [ /*{{{*/
// ["xxx", "todo"],
// ["<C-w>", "delete word"],