diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js
index eeebdb1e..d83abebf 100644
--- a/chrome/content/vimperator/commands.js
+++ b/chrome/content/vimperator/commands.js
@@ -164,7 +164,7 @@ var g_commands = [/*{{{*/
["help", "h"],
["h[elp] {subject}"],
"Open the help window in the current tab. It can jump to the specified {subject} with :help {subject}.",
- help,
+ null,//help,
function(filter) { return get_help_completions(filter); }
],
[
@@ -325,7 +325,7 @@ var g_commands = [/*{{{*/
"Executes {cmd} and tells it to output in a new tab. Works for commands that support it.
" +
"Example: :tab help tab Opens the help in a new tab.",
tab,
- null,
+ null
],
[
["tabnext", "tabn", "tn", "tnext"],
@@ -1822,238 +1822,6 @@ function source(filename, silent)
}
}
-function help(section, easter)
-{
- if (easter)
- {
- echoerr("E478: Don't panic!");
- return;
- }
- if (arguments[3].inTab)
- openURLsInNewTab("", true);
-
- var doc = window.content.document;
-
- var style = "";
-
-
- var header = '
Vimperator
' +
- 'First there was a Navigator, then there was an Explorer. Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)
'
-
- var introduction = 'Introduction
' +
- 'Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor. ' +
- 'It has similar key bindings, and you could call it a modal webbrowser, as key bindings differ according to which mode you are in.
' +
-
- 'Warning: To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden. If you really need them, type: :set guioptions=mT to get it back. ' +
- 'If you don\'t like Vimperator at all, you can uninstall it by typing :addons and remove/disable it. ' +
- 'If you like it, but can\'t remember the shortcuts, press F1 or :help to get this help window back.
' +
-
- 'Since Vimperator\'s GUI is embedded into a toolbar, it may look too 3D-like with the default theme. For best experience, I therefore recommend the Whitehart theme.
' +
-
- ' Vimperator was written by Martin Stubenschrott. If you appreciate my work on Vimperator, you can either send me greetings, patches ' +
- 'or make a donation: ' +
-
- '
' +
-
- 'Of course as a believer in free open source software, only make a donation if you really like Vimperator, and the money doesn\'t hurt - otherwise just use it, recommend it and like it :)'
-
-// xxx: for firebug: :exec Firebug.toggleBar(true)
-
- /* commands = array where help information is located
- * color = used for background of the table
- * beg = string which is printed before the commmand/setting/mapping name
- * end = string which is printed after the commmand/setting/mapping name
- * func = called with 'commands' array and result which is a sring is prepended to the help text
- */
- function makeHelpString(commands, color, beg, end, func)
- {
- var ret = "";
- for (var i=0; i < commands.length; i++)
- {
- ret += '';
- for (var j=0; j < commands[i][0].length; j++)
- {
- var cmd_name = commands[i][0][j];
- cmd_name = cmd_name.replace(//g, ">");
- ret += "" +beg+ cmd_name +end+ '';
- }
- ret += ' |
';
- for (var j=0; j < commands[i][1].length; j++)
- {
- var usage = commands[i][1][j];
-
- usage = usage.replace(/<(?!br\/>)/g, "<");
- usage = usage.replace(/[^b][^r][^\/]>/g, ">");
- ret += "" +beg+ usage +end+ ' ';
- }
- ret += ' | ';
- if (func)
- ret += func.call(this, commands[i]);
- if (commands[i][2])
- {
- if(func)
- ret += " "
- ret += commands[i][2]; // the help description
- }
- ret += ' |
';
- }
- return ret;
- }
- function makeSettingsHelpString(command)
- {
- var ret = "";
- ret = command[5] + " (default: ";
- if (command[5] == "boolean")
- {
- if(command[6] == true)
- ret += "on";
- else
- ret += "off";
- }
- else
- {
- if (typeof command[6] == 'string' && command[6].length == 0)
- ret += "''";
- else
- ret += command[6];
- }
-
- ret += ")
";
- return ret;
- }
-
- var mappings = 'Mappings
'+
- 'The denotion of modifier keys is like in Vim, so C- means the Control key, M- the Meta key, A- the Alt key and S- the Shift key.
'+
- ''
- mappings += makeHelpString(g_mappings, "#102663", "", "", null);
- mappings += '
';
- if (section && section == 'holy-grail')
- mappings += 'You found it, Arthur!';
-
- var commands = 'Commands
'
- commands += makeHelpString(g_commands, "#632610", ":", "", null);
- commands += '
';
- if (section && section == '42')
- commands += 'What is the meaning of life, the universe and everything?
' +
- 'Douglas Adams, the only person who knew what this question really was about is
' +
- 'now dead, unfortunately. So now you might wonder what the meaning of death
' +
- 'is...
';
-
- var settings = 'Settings
'
- settings += makeHelpString(g_settings, "#106326", "'", "'", makeSettingsHelpString);
- settings += '
';
-
- var fulldoc = 'Vimperator help' +
- style +
- '' +
- header +
- introduction +
- mappings +
- commands +
- settings +
- ''
-
- doc.open();
- doc.write(fulldoc);
- doc.close();
- if (section)
- {
- var element = doc.getElementById(section);
- if (!element)
- {
- echoerr("E149: Sorry, no help for " + section);
- return;
- }
- var pos = cumulativeOffset(element);
- // horizontal offset is annyoing, set it to 0 (use pos[0] if you want horizontal offset)
- window.content.scrollTo(0, pos[1]);
- }
-}
-
-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);
-
- return [valueL, valueT];
-}
-
diff --git a/chrome/content/vimperator/completion.js b/chrome/content/vimperator/completion.js
index e4adb041..2827e00e 100644
--- a/chrome/content/vimperator/completion.js
+++ b/chrome/content/vimperator/completion.js
@@ -180,27 +180,6 @@ function completion_select_previous_item()/*{{{*/
}/*}}}*/
-function get_file_completions(filter)/*{{{*/
-{
- g_completions = [];
-
- var match = filter.match(/^(.*[\/\\])(.*?)$/);
- var dir;
- if (!match || !(dir = match[1])) return [];
- var compl = match[2] || '';
- var fd = fopen(dir, "<");
- if (!fd) return [];
- var entries = fd.read();
- var delim = fd.path.length == 1 ? '' : (fd.path.search(/\\/) != -1) ? "\\" : "/";
- var reg = new RegExp("^" + fd.path + delim + compl);
- entries.forEach(function(file) {
- if (file.path.search(reg) != -1)
- g_completions.push([file.path, '']);
- });
-
- return g_completions;
-}/*}}}*/
-
/*
* filter a list of urls
@@ -288,6 +267,32 @@ outer:
return filtered.concat(additional_completions);
}/*}}}*/
+function get_file_completions(filter)/*{{{*/
+{
+ g_completions = [];
+ var match = filter.match(/^(.*[\/\\])(.*?)$/);
+ var dir;
+
+ if (!match || !(dir = match[1]))
+ return [];
+
+ var compl = match[2] || '';
+ var fd = fopen(dir, "<");
+ if (!fd)
+ return [];
+
+ var entries = fd.read();
+ var delim = fd.path.length == 1 ? '' : (fd.path.search(/\\/) != -1) ? "\\" : "/";
+ var reg = new RegExp("^" + fd.path + delim + compl);
+ entries.forEach(function(file)
+ {
+ if (file.path.search(reg) != -1)
+ g_completions.push([file.path, '']);
+ });
+
+ return g_completions;
+}/*}}}*/
+
function get_search_completions(filter)/*{{{*/
{
var search_completions = [];
diff --git a/chrome/content/vimperator/help.js b/chrome/content/vimperator/help.js
new file mode 100644
index 00000000..2812a743
--- /dev/null
+++ b/chrome/content/vimperator/help.js
@@ -0,0 +1,263 @@
+/***** BEGIN LICENSE BLOCK ***** {{{
+Version: MPL 1.1/GPL 2.0/LGPL 2.1
+
+The contents of this file are subject to the Mozilla Public License Version
+1.1 (the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the
+License.
+
+(c) 2006-2007: Martin Stubenschrott
+
+Alternatively, the contents of this file may be used under the terms of
+either the GNU General Public License Version 2 or later (the "GPL"), or
+the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+in which case the provisions of the GPL or the LGPL are applicable instead
+of those above. If you wish to allow use of your version of this file only
+under the terms of either the GPL or the LGPL, and not to allow others to
+use your version of this file under the terms of the MPL, indicate your
+decision by deleting the provisions above and replace them with the notice
+and other provisions required by the GPL or the LGPL. If you do not delete
+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)
+{
+ if (easter)
+ {
+ echoerr("E478: Don't panic!");
+ return;
+ }
+ if (arguments[3] && arguments[3].inTab)
+ openURLsInNewTab("", true);
+
+ var doc = window.content.document;
+
+ var style = "";
+
+
+ var header = 'Vimperator
' +
+ 'First there was a Navigator, then there was an Explorer. Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)
'
+
+ var introduction = 'Introduction
' +
+ 'Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor. ' +
+ 'It has similar key bindings, and you could call it a modal webbrowser, as key bindings differ according to which mode you are in.
' +
+
+ 'Warning: To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden. If you really need them, type: :set guioptions=mT to get it back. ' +
+ 'If you don\'t like Vimperator at all, you can uninstall it by typing :addons and remove/disable it. ' +
+ 'If you like it, but can\'t remember the shortcuts, press F1 or :help to get this help window back.
' +
+
+ 'Since Vimperator\'s GUI is embedded into a toolbar, it may look too 3D-like with the default theme. For best experience, I therefore recommend the Whitehart theme.
' +
+
+ ' Vimperator was written by Martin Stubenschrott. If you appreciate my work on Vimperator, you can either send me greetings, patches ' +
+ 'or make a donation: ' +
+
+ '
' +
+
+ 'Of course as a believer in free open source software, only make a donation if you really like Vimperator, and the money doesn\'t hurt - otherwise just use it, recommend it and like it :)'
+
+// xxx: for firebug: :exec Firebug.toggleBar(true)
+
+ /* commands = array where help information is located
+ * color = used for background of the table
+ * beg = string which is printed before the commmand/setting/mapping name
+ * end = string which is printed after the commmand/setting/mapping name
+ * func = called with 'commands' array and result which is a sring is prepended to the help text
+ */
+ function makeHelpString(commands, color, beg, end, func)
+ {
+ var ret = "";
+ for (var i=0; i < commands.length; i++)
+ {
+ ret += '';
+ for (var j=0; j < commands[i][0].length; j++)
+ {
+ var cmd_name = commands[i][0][j];
+ cmd_name = cmd_name.replace(//g, ">");
+ ret += "" +beg+ cmd_name +end+ '';
+ }
+ ret += ' |
';
+ for (var j=0; j < commands[i][1].length; j++)
+ {
+ var usage = commands[i][1][j];
+
+ usage = usage.replace(/<(?!br\/>)/g, "<");
+ usage = usage.replace(/[^b][^r][^\/]>/g, ">");
+ ret += "" +beg+ usage +end+ ' ';
+ }
+ ret += ' | ';
+ if (func)
+ ret += func.call(this, commands[i]);
+ if (commands[i][2])
+ {
+ if(func)
+ ret += " "
+ ret += commands[i][2]; // the help description
+ }
+ ret += ' |
';
+ }
+ return ret;
+ }
+ function makeSettingsHelpString(command)
+ {
+ var ret = "";
+ ret = command[5] + " (default: ";
+ if (command[5] == "boolean")
+ {
+ if(command[6] == true)
+ ret += "on";
+ else
+ ret += "off";
+ }
+ else
+ {
+ if (typeof command[6] == 'string' && command[6].length == 0)
+ ret += "''";
+ else
+ ret += command[6];
+ }
+
+ ret += ")
";
+ return ret;
+ }
+
+ var mappings = 'Mappings
'+
+ 'The denotion of modifier keys is like in Vim, so C- means the Control key, M- the Meta key, A- the Alt key and S- the Shift key.
'+
+ ''
+ mappings += makeHelpString(g_mappings, "#102663", "", "", null);
+ mappings += '
';
+ if (section && section == 'holy-grail')
+ mappings += 'You found it, Arthur!';
+
+ var commands = 'Commands
'
+ commands += makeHelpString(g_commands, "#632610", ":", "", null);
+ commands += '
';
+ if (section && section == '42')
+ commands += 'What is the meaning of life, the universe and everything?
' +
+ 'Douglas Adams, the only person who knew what this question really was about is
' +
+ 'now dead, unfortunately. So now you might wonder what the meaning of death
' +
+ 'is...
';
+
+ var settings = 'Settings
'
+ settings += makeHelpString(g_settings, "#106326", "'", "'", makeSettingsHelpString);
+ settings += '
';
+
+ var fulldoc = 'Vimperator help' +
+ style +
+ '' +
+ header +
+ introduction +
+ mappings +
+ commands +
+ settings +
+ ''
+
+ doc.open();
+ doc.write(fulldoc);
+ doc.close();
+
+ 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);
+
+ return [valueL, valueT];
+ }
+
+ if (section)
+ {
+ var element = doc.getElementById(section);
+ if (!element)
+ {
+ echoerr("E149: Sorry, no help for " + section);
+ return;
+ }
+ var pos = cumulativeOffset(element);
+ // horizontal offset is annyoing, set it to 0 (use pos[0] if you want horizontal offset)
+ window.content.scrollTo(0, pos[1]);
+ }
+}
+
+// vim: set fdm=marker sw=4 ts=4 et:
diff --git a/chrome/content/vimperator/tags b/chrome/content/vimperator/tags
index b08b4891..4bf7b897 100644
--- a/chrome/content/vimperator/tags
+++ b/chrome/content/vimperator/tags
@@ -24,15 +24,21 @@ copyToClipboard commands.js /^function copyToClipboard(str)$/;" f
createCursorPositionString vimperator.js /^function createCursorPositionString()$/;" f
createHints hints.js /^ function createHints(win)$/;" f
createProgressBar vimperator.js /^function createProgressBar(aProgress)$/;" f
+cumulativeOffset commands.js /^function cumulativeOffset(element)$/;" f
deleteBookmark bookmarks.js /^function deleteBookmark(url)$/;" f
del_url_mark commands.js /^function del_url_mark(mark)$/;" f
echo commands.js /^function echo(msg)$/;" f
echoerr commands.js /^function echoerr(msg)$/;" f
-execute_command commands.js /^function execute_command(count, cmd, special, args) \/\/ {{{$/;" f
+execute commands.js /^function execute(string)$/;" f
+execute_command commands.js /^function execute_command(count, cmd, special, args, modifiers) \/\/ {{{$/;" f
filter_url_array completion.js /^function filter_url_array(urls, filter, use_regex)\/*{{{*\/$/;" f
focusContent vimperator.js /^function focusContent(clear_command_line, clear_statusline)$/;" f
focusNextFrame commands.js /^function focusNextFrame()$/;" f
+fopen file.js /^function fopen (path, mode, perms, tmp)$/;" f
formatHint hints.js /^ function formatHint(hintNum)$/;" f
+fo_close file.js /^function fo_close()$/;" f
+fo_read file.js /^function fo_read(max)$/;" f
+fo_write file.js /^function fo_write(buf)$/;" f
genElemCoords hints.js /^ function genElemCoords(elem)$/;" f
genHintContainer hints.js /^ function genHintContainer(doc)$/;" f
getCurrentLinkLocation commands.js /^function getCurrentLinkLocation()$/;" f
@@ -45,7 +51,9 @@ get_bookmark_completions completion.js /^function get_bookmark_completions(filte
get_buffer_completions completion.js /^function get_buffer_completions(filter)$/;" f
get_command commands.js /^function get_command(cmd) \/\/ {{{$/;" f
get_command_completions completion.js /^function get_command_completions(filter)\/*{{{*\/$/;" f
+get_file_completions completion.js /^function get_file_completions(filter)\/*{{{*\/$/;" f
get_firefox_pref settings.js /^function get_firefox_pref(name, default_value)$/;" f
+get_help_completions completion.js /^function get_help_completions(filter)$/;" f
get_history_completions completion.js /^function get_history_completions(filter)\/*{{{*\/$/;" f
get_pref settings.js /^function get_pref(name, forced_default)$/;" f
get_search_completions completion.js /^function get_search_completions(filter)\/*{{{*\/$/;" f
@@ -53,9 +61,10 @@ get_setting settings.js /^function get_setting(cmd)$/;" f
get_settings_completions completion.js /^function get_settings_completions(filter)\/*{{{*\/$/;" f
get_url_completions completion.js /^function get_url_completions(filter)\/*{{{*\/$/;" f
get_url_mark commands.js /^function get_url_mark(mark)$/;" f
-goUp commands.js /^function goUp() \/\/ FIXME$/;" f
hasMode commands.js /^function hasMode(mode)$/;" f
help commands.js /^function help(section, easter)$/;" f
+historyGoToBeginning commands.js /^function historyGoToBeginning()$/;" f
+historyGoToEnd commands.js /^function historyGoToEnd()$/;" f
hit_a_hint hints.js /^function hit_a_hint()$/;" f
hsshow commands.js /^function hsshow(filter, fullmode)$/;" f
init vimperator.js /^function init()$/;" f
@@ -64,12 +73,15 @@ invalidateCoords hints.js /^ function invalidateCoords(doc)$/;" f
isFormElemFocused vimperator.js /^function isFormElemFocused()$/;" f
keyToString vimperator.js /^function keyToString(event)$/;" f
load_history completion.js /^function load_history()$/;" f
+LocalFile file.js /^function LocalFile(file, mode, perms, tmp)$/;" f
logMessage vimperator.js /^function logMessage(msg)$/;" f
makeHelpString commands.js /^ function makeHelpString(commands, color, beg, end, func)$/;" f
makeSettingsHelpString commands.js /^ function makeSettingsHelpString(command)$/;" f
+multiliner commands.js /^function multiliner(line, prev_match, heredoc)$/;" f
nsBrowserStatusHandler vimperator.js /^function nsBrowserStatusHandler() \/*{{{*\/$/;" f
onCommandBarInput vimperator.js /^function onCommandBarInput(event)$/;" f
onCommandBarKeypress vimperator.js /^function onCommandBarKeypress(evt)\/*{{{*\/$/;" f
+onCommandBarMouseDown vimperator.js /^function onCommandBarMouseDown(event)$/;" f
onEscape vimperator.js /^function onEscape()$/;" f
onResize hints.js /^ function onResize(event)$/;" f
onVimperatorKeypress vimperator.js /^function onVimperatorKeypress(event)\/*{{{*\/$/;" f
@@ -106,15 +118,17 @@ showMode commands.js /^function showMode()$/;" f
showStatusbarMessage vimperator.js /^function showStatusbarMessage(msg, field)$/;" f
show_location_marks commands.js /^function show_location_marks(mark)$/;" f
show_url_marks commands.js /^function show_url_marks(mark)$/;" f
-source commands.js /^function source(filename)$/;" f
+source commands.js /^function source(filename, silent)$/;" f
startCoordLoader hints.js /^ function startCoordLoader(doc)$/;" f
stepInHistory commands.js /^function stepInHistory(steps)$/;" f
stringToURLs commands.js /^function stringToURLs(str)$/;" f
+tab commands.js /^function tab()$/;" f
tab_go commands.js /^function tab_go(index)$/;" f
tab_remove commands.js /^function tab_remove(count, focus_left_tab, quit_on_last_tab)$/;" f
toggle_images commands.js /^function toggle_images() {$/;" f
+tokenize_ex commands.js /^function tokenize_ex(string, tag)$/;" f
unload vimperator.js /^function unload()$/;" f
-updateStatusbar vimperator.js /^function updateStatusbar()$/;" f
+updateStatusbar vimperator.js /^function updateStatusbar(message)$/;" f
yankCurrentLocation commands.js /^function yankCurrentLocation()$/;" f
zoom_in commands.js /^function zoom_in(factor)$/;" f
zoom_to commands.js /^function zoom_to(value)$/;" f
diff --git a/chrome/content/vimperator/vimperator.xul b/chrome/content/vimperator/vimperator.xul
index d8822729..5726788c 100644
--- a/chrome/content/vimperator/vimperator.xul
+++ b/chrome/content/vimperator/vimperator.xul
@@ -41,6 +41,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
+