diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js
index 5068cba2..0bb304eb 100644
--- a/chrome/content/vimperator/commands.js
+++ b/chrome/content/vimperator/commands.js
@@ -62,7 +62,7 @@ var g_commands = [/*{{{*/
["beep"],
"Play a system beep",
null,
- function() { beep(); },
+ beep,
null
],
[
@@ -72,7 +72,7 @@ var g_commands = [/*{{{*/
"If you don't add a custom title, either the title of the webpage or the URL will be taken as the title.
"+
"Tags WILL be some mechanism to classify bookmarks. Assume, you tag a url with the tags \"linux\" and \"computer\" you'll be able to search for bookmarks containing these tags.
" +
"You can omit the optional [url] field, so just do :bmadd to bookmark the currently loaded web page with a default title and without any tags.",
- function(args) { bmadd(args); },
+ bmadd,
null
],
[
@@ -80,7 +80,7 @@ var g_commands = [/*{{{*/
"Delete a bookmark",
"Usage: :bmdel [-T \"comma,separated,tags\"] <url>
" +
"Deletes all bookmarks which matches the url AND the specified tags. Use <Tab> key on a regular expression to complete the url which you want to delete.",
- function(args) { bmdel(args); },
+ bmdel,
function(filter) { return get_bookmark_completions(filter); }
],
[
@@ -89,7 +89,7 @@ var g_commands = [/*{{{*/
"Usage: :bm [-T \"comma,separated,tags\"] <regexp>
" +
"Open the preview window at the bottom of the screen for all bookmarks which match the regexp either in the title or URL.
" +
"Close this window with :pclose or open entries with double click in the current tab or middle click in a new tab.",
- function(args, special) { bmshow(args, special); },
+ bmshow,
function(filter) { return get_bookmark_completions(filter); }
],
[
@@ -118,14 +118,14 @@ var g_commands = [/*{{{*/
["echo", "ec"],
"Display a string at the bottom of the window",
"Echo all arguments of this command. Useful for showing informational messages.
Multiple lines WILL be seperated by \\n.",
- function(args) { echo(args); },
+ echo,
null
],
[
["echoerr", "echoe"],
"Display an error string at the bottom of the window",
"Echo all arguments of this command highlighted in red. Useful for showing important messages.
Multiple lines WILL be seperated by \\n.",
- function(args) { echoerr(args); },
+ echoerr,
null
],
[
@@ -160,7 +160,7 @@ var g_commands = [/*{{{*/
["help", "h"],
"Open help window",
"Open the help window in the current tab. You WILL be able to show a specific section with :help commands.",
- function() { help(null); },
+ help,
null
],
[
@@ -169,7 +169,7 @@ var g_commands = [/*{{{*/
"Usage: :hs <regexp>
" +
"Open the preview window at the bottom of the screen for all history items which match the regexp either in the title or URL.
" +
"Close this window with :pclose or open entries with double click in the current tab or middle click in a new tab.",
- function(args, special) { hsshow(args, special); },
+ hsshow,
function(filter) { return get_history_completions(filter); }
],
[
@@ -227,7 +227,7 @@ var g_commands = [/*{{{*/
"Show Browser Preferences",
"You can change the browser preferences from this dialog.
Be aware that not all Firefox preferences work, because Vimperator overrides some keybindings and changes Firefox's GUI.
"+
"Works like :set!, but opens the dialog in a new window instead of a new tab. Use this, if you experience problems/crashes when using :set!",
- function() { openPreferences(); },
+ openPreferences,
null
],
[
@@ -255,7 +255,7 @@ var g_commands = [/*{{{*/
["restart"],
"Restarts the browser",
"Forces the browser to restart.",
- function(args, special) { restart(); },
+ restart,
null
],
[
@@ -275,14 +275,14 @@ var g_commands = [/*{{{*/
":set! opens the GUI preference panel from Firefox in a new tab.
"+
":set option? or :set option shows the current value of the option.
"+
":set option+=foo and :set option-=foo WILL add/remove foo from list options.
",
- function(args, special) { set(args, special); },
+ set,
function(filter) { return get_settings_completions(filter); }
],
[
["source", "so"],
"Load a local javascript file and execute it",
"Not implemented yet",
- function(args) { source(args); },
+ source,
null
],
[
@@ -360,7 +360,7 @@ var g_commands = [/*{{{*/
"Set zoom value of the webpage",
"Usage: :zoom 150 zooms to 150% text size.
"+
"Zoom value can be between 25 and 500%. If it is omitted, zoom is reset to 100%.",
- function (args) { zoom_to(args); },
+ zoom_to,
null
]
];/*}}}*/
@@ -380,7 +380,7 @@ var g_mappings = [/*{{{*/
"Focus next frame",
"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.",
- function(count) { focusNextFrame(); }
+ focusNextFrame
],
[
["b"],
@@ -388,6 +388,12 @@ var g_mappings = [/*{{{*/
"Typing the corresponding number opens switches to this buffer",
function (args) { bushow("", true); openVimperatorBar('buffer '); }
],
+ /*[
+ ["B"],
+ "Toggle buffer list",
+ "Open the preview window with all currently opened tabs",
+ function (args) { preview_window.hidden == true ? bushow("", false) : preview_window.hidden = true; }
+ ],*/
[
["d"],
"Delete current buffer (=tab)",
@@ -411,7 +417,7 @@ var g_mappings = [/*{{{*/
["gh"],
"Go home",
"Opens the homepage in the current tab.",
- function(count) { BrowserHome(); }
+ BrowserHome
],
[
["gH"],
@@ -499,7 +505,7 @@ var g_mappings = [/*{{{*/
["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.",
- function(count) { yankCurrentLocation(); }
+ yankCurrentLocation
],
[
["zi"],
@@ -534,7 +540,7 @@ var g_mappings = [/*{{{*/
"Set zoom value of the webpage",
"150zz zooms to 150% text size.
"+
"Zoom value can be between 25 and 500%. If it is omitted, zoom is reset to 100%.",
- function(count) { zoom_to(count); }
+ zoom_to
],
[
["ZQ"],
@@ -686,13 +692,13 @@ var g_mappings = [/*{{{*/
["n"],
"Find next",
"Repeat the last \"/\" 1 time (until count is supported).",
- function(count) { gFindBar.onFindAgainCmd(); } // this does not work, why?: goDoCommand('cmd_findAgain'); }
+ gFindBar.onFindAgainCmd // this does not work, why?: goDoCommand('cmd_findAgain'); }
],
[
["N"],
"Find previous",
"Repeat the last \"/\" 1 time (until count is supported) in the opposite direction.",
- function(count) { gFindBar.onFindPreviousCmd(); } // this does not work, why?: goDoCommand('cmd_findPrevious'); }
+ gFindBar.onFindPreviousCmd // this does not work, why?: goDoCommand('cmd_findPrevious'); }
],
/* vimperator managment */
@@ -715,7 +721,7 @@ var g_mappings = [/*{{{*/
"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) { addMode(MODE_ESCAPE_ALL_KEYS); echo("Vimperator keys disabled. Press to reenable.");}
+ function(count) { addMode(MODE_ESCAPE_ALL_KEYS);}
],
[
[""], // if you ever add/remove keys here, also check them in the onVimperatorKeypress() function
@@ -730,7 +736,7 @@ var g_mappings = [/*{{{*/
"Cancel any operation",
"Stops loading the current webpage and exits any command line or hint mode.
"+
"Also focuses the web page, in case a form field has focus, and eats our key presses.",
- function(count) { onEscape(); }
+ onEscape
],
/* quick bookmark access - will be customizable in future*/
@@ -857,6 +863,16 @@ var g_searchengines = [ /*{{{*/
["vim", "http://www.google.com/custom?q=%s&sa=Google+Search&cof=LW%3A125%3BL%3Ahttp%3A%2F%2Fvim.sf.net%2Fimages%2Fvim.gif%3BLH%3A60%3BAH%3Acenter%3BGL%3A0%3BS%3Ahttp%3A%2F%2Fwww.vim.org%3BAWFID%3A057fa53529d52655%3B&domains=vim.sourceforge.net%3Bwww.vim.org%3Bvimdoc.sourceforge.net&sitesearch=vim.sourceforge.net"]
];/*}}}*/
+var g_modemessages = {};
+g_modemessages[MODE_NORMAL | MODE_ESCAPE_ALL_KEYS] = "ESCAPE ALL KEYS";
+g_modemessages[MODE_NORMAL | MODE_ESCAPE_ONE_KEY] = "ESCAPE ONE KEY";
+g_modemessages[MODE_NORMAL | MODE_ESCAPE_ALL_KEYS | MODE_ESCAPE_ONE_KEY] = "PASS ONE KEY";
+g_modemessages[HINT_MODE_QUICK] = "QUICK HINT";
+g_modemessages[HINT_MODE_ALWAYS] = "ALWAYS HINT";
+g_modemessages[HINT_MODE_EXTENDED] = "EXTENDED HINT";
+g_modemessages[MODE_NORMAL] = false;
+g_modemessages[MODE_INSERT] = "INSERT";
+g_modemessages[MODE_VISUAL] = "VISUAL";
// returns null, if the cmd cannot be found in our g_commands array, or
// otherwise a refernce to our command
@@ -1375,7 +1391,7 @@ function zoom_to(value)
////////////////////////////////////////////////////////////////////////
-// misc helper funcstions ///////////////////////////////////////// {{{1
+// misc helper functions ////////////////////////////////////////// {{{1
////////////////////////////////////////////////////////////////////////
function copyToClipboard(str)
@@ -1404,6 +1420,8 @@ function quit(save_session)
{
if (save_history)
set_firefox_pref("browser.sessionstore.resume_session_once", true);
+ else
+ set_firefox_pref("browser.sessionstore.resume_session_once", false);
goQuitApplication();
}
@@ -1548,8 +1566,14 @@ function source(filename)
}
-function help(section)
+function help(section, easter)
{
+ if (easter)
+ {
+ echoerr("E478: Don't panic!");
+ return;
+ }
+
var doc = window.content.document;
var style = "