diff --git a/NEWS b/NEWS
index e8a2f63a..de394988 100644
--- a/NEWS
+++ b/NEWS
@@ -2,9 +2,10 @@
2007-XX-XX:
* version 0.5.2
* added 'visualbellstyle' for styling/hiding the visual bell
- * :buffer partial_string works now as in vim, and with ! even better
* merge the existing status bar with the standard FF status bar so that
security information and extension buttons are included
+ * :buffer partial_string works now as in vim, and with ! even better
+ * new :time command for profiling
* added new :sidebar and :sbclose commands
* added 'more' and standard more-prompt key mappings to control
behaviour of the message list pager
@@ -12,7 +13,9 @@
highlighted text strings when 'hlsearch' is set
* added 'linksearch' option to restrict page searches to link text - \U
and \u can be used in the search pattern to override 'linksearch'
+ * vimperator trys to stay in command mode after loading pages instead of having a text field focused
* added a visual bell and replaced 'beep' with 'visualbell'
+ * added vimperator logo (can be seen in the addons manager)
* added 'hlsearch','incsearch', 'ignorecase' and 'smartcase' options
2007-09-03:
diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js
index d3f0b838..0f868897 100644
--- a/chrome/content/vimperator/commands.js
+++ b/chrome/content/vimperator/commands.js
@@ -1251,6 +1251,85 @@ function Commands() //{{{
short_help: "Switch to the first tab"
}
));
+ addDefaultCommand(new Command(["time"],
+ function(args, special, count)
+ {
+ if (!count || count < 1)
+ count = 1;
+
+ try
+ {
+ if (count > 1)
+ {
+ var i = count;
+ var before_time = Date.now();
+
+ if (args && args[0] == ":")
+ while (i--)
+ vimperator.execute(args);
+ else
+ while (i--)
+ eval(args);
+
+ if (special)
+ return;
+
+ var after_time = Date.now();
+
+ if ((after_time - before_time) / count >= 100)
+ var each = " Each time: " +
+ ((after_time - before_time) / 1000.0 / count) +
+ " sec
";
+ else
+ var each = " Each time: " +
+ ((after_time - before_time) / count) +
+ " msec
";
+
+ if (after_time - before_time >= 100)
+ var total = " Total time: " +
+ ((after_time - before_time) / 1000.0) +
+ " sec";
+ else
+ var total = " Total time: " +
+ (after_time - before_time) + " msec";
+
+
+ vimperator.echo("Code execution summary:
" +
+ " Executed: " + count + " times
" + each + total);
+ }
+ else
+ {
+ var before_time = Date.now();
+ if (args && args[0] == ":")
+ vimperator.execute(args);
+ else
+ eval(args);
+
+ if (special)
+ return;
+
+ var after_time = Date.now();
+
+ if (after_time - before_time >= 100)
+ vimperator.echo("Total time: " + ((after_time - before_time) / 1000.0) + " sec");
+ else
+ vimperator.echo("Total time: " + (after_time - before_time) + " msec");
+ }
+ }
+ catch (e)
+ {
+ vimperator.echoerr(e);
+ }
+ },
+ {
+ usage: ["{count}time[!] {code|:command}"],
+ short_help: "Profile a piece of code or a command",
+ help: "Runs {code} {count} times (default 1) and returns the elapsed time. " +
+ "{code} is always passed to JavaScript's eval(), which might be slow, so take the results with a grain of salt.
" +
+ "If {code} starts with a :, it is executed as a vimperator command.
" +
+ "Use the special version with [!] if you just want to run any command multiple times without showing profiling statistics."
+ }
+ ));
addDefaultCommand(new Command(["u[ndo]"],
function(args, special, count) { if (count < 1) count = 1; undoCloseTab(count-1); },
{