diff --git a/ChangeLog b/ChangeLog index 657b43c9..7fbd7282 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@
 2007-07-02:
 	* version 0.5
+	* files in ~/.vimperator/plugin/ are auto-sourced
 	* :winopen support (multiple windows still very very experimental)
 	* 'activate' option implemented
 	* search enginges which use POST instead of GET work now
diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js
index 5b6ad22a..976c6f19 100644
--- a/chrome/content/vimperator/commands.js
+++ b/chrome/content/vimperator/commands.js
@@ -913,7 +913,13 @@ function Commands() //{{{
         {
             usage: ["so[urce][!] {file}"],
             short_help: "Read Ex commands from {file}",
-            help: "The .vimperatorrc file in your home directory is always sourced at start up.
" + + help: "You can either source files which mostly contain Ex commands like map < gt " + + "and put javascript code within a:
" + + "js <<EOF
hello = function() {
  alert(\"Hello world\");
}
EOF
section.
" + + "Or you can alternatively source a file which ends in .js, these files are automatically sourced as pure javascript files.
" + + "NOTE: In both cases you must add functions to the global window object like shown above, functions written as:
" + + "function hello2() {
  alert(\"Hello world\");
}
are only available within the scope of the script.

" + + "The .vimperatorrc file in your home directory and any files in ~/.vimperator/plugin/ are always sourced at startup.
" + "~ is supported as a shortcut for the $HOME directory.
" + "If ! is specified, errors are not printed.", completer: function(filter) { return get_file_completions(filter); } @@ -1117,6 +1123,7 @@ function execute_command(count, cmd, special, args, modifiers) //{{{ { if (!cmd) return; + if (!modifiers) modifiers = {}; @@ -1201,10 +1208,9 @@ function execute(string) } -/* takes a string like 'google bla| www.osnews.com' +/* takes a string like 'google bla, www.osnews.com' * and returns an array ['www.google.com/search?q=bla', 'www.osnews.com'] */ -//function stringToURLs(str) String.prototype.toURLArray = function() { var urls = this.split(/\s*\,\s+/); diff --git a/chrome/content/vimperator/completion.js b/chrome/content/vimperator/completion.js index bc3c4b1b..b631a55a 100644 --- a/chrome/content/vimperator/completion.js +++ b/chrome/content/vimperator/completion.js @@ -245,6 +245,7 @@ function get_file_completions(filter) //{{{ /* This is now also used as part of the url completion, so the substrings shouldn't be cleared for that case */ if (!arguments[1]) g_substrings = []; + var match = filter.match(/^(.*[\/\\])(.*?)$/); var dir; diff --git a/chrome/content/vimperator/default.css b/chrome/content/vimperator/default.css index a6b8be52..79f5d68d 100644 --- a/chrome/content/vimperator/default.css +++ b/chrome/content/vimperator/default.css @@ -107,6 +107,10 @@ fieldset.paypal { color: #106326; } +.code { + color: #108826; +} + .shorthelp { font-weight: bold; } diff --git a/chrome/content/vimperator/ui.js b/chrome/content/vimperator/ui.js index e24d164c..39ea4531 100644 --- a/chrome/content/vimperator/ui.js +++ b/chrome/content/vimperator/ui.js @@ -27,46 +27,46 @@ the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ // XXX: move somehere else! -function multiliner(line, prev_match, heredoc) //{{{ -{ - var end = true; - var match = tokenize_ex(line, prev_match[4]); - if (prev_match[3] === undefined) prev_match[3] = ''; - if (match[4] === null) - { - vimperator.focusContent(); - execute_command.apply(this, match); - } - else - { - if (match[4] === false) - { - prev_match[3] = prev_match[3].replace(new RegExp('<<\s*' + prev_match[4]), heredoc.replace(/\n$/, '')); - vimperator.focusContent(); // also sets comp_tab_index to -1 - execute_command.apply(this, prev_match); - prev_match = new Array(5); - prev_match[3] = ''; - heredoc = ''; - } - else - { - end = false; - if (!prev_match[3]) - { - prev_match[0] = match[0]; - prev_match[1] = match[1]; - prev_match[2] = match[2]; - prev_match[3] = match[3]; - prev_match[4] = match[4]; - } - else - { - heredoc += match[3] + '\n'; - } - } - } - return [prev_match, heredoc, end]; -} //}}} +// function multiliner(line, prev_match, heredoc) //{{{ +// { +// var end = true; +// var match = tokenize_ex(line, prev_match[4]); +// if (prev_match[3] === undefined) prev_match[3] = ''; +// if (match[4] === null) +// { +// vimperator.focusContent(); +// execute_command.apply(this, match); +// } +// else +// { +// if (match[4] === false) +// { +// prev_match[3] = prev_match[3].replace(new RegExp('<<\s*' + prev_match[4]), heredoc.replace(/\n$/, '')); +// vimperator.focusContent(); // also sets comp_tab_index to -1 +// execute_command.apply(this, prev_match); +// prev_match = new Array(5); +// prev_match[3] = ''; +// heredoc = ''; +// } +// else +// { +// end = false; +// if (!prev_match[3]) +// { +// prev_match[0] = match[0]; +// prev_match[1] = match[1]; +// prev_match[2] = match[2]; +// prev_match[3] = match[3]; +// prev_match[4] = match[4]; +// } +// else +// { +// heredoc += match[3] + '\n'; +// } +// } +// } +// return [prev_match, heredoc, end]; +// } //}}} /* * This class is used for prompting of user input and echoing of messages diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index e9a2f2bb..dba38192 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -277,7 +277,7 @@ const vimperator = (function() //{{{ var postdata = typeof urls[0] == "string" ? null : urls[0][1]; var whichwindow = window; - // decide where to load the first tab + // decide where to load the first url switch (where) { case vimperator.CURRENT_TAB: @@ -454,11 +454,14 @@ const vimperator = (function() //{{{ } }, + // files which end in .js are sourced as pure javascript files, + // no need (actually forbidden) to add: js <