js <<EOF hello = function () { alert("Hello world"); } EOF
repeat
Vimperator can repeat a number of commands or record macros…
Macros | complex-repeat macros |
q
Record a key sequence into a macro. Available macros are {0-9a-zA-Z} (uppercase to append). Type q to stop recording.
:macros
List recorded macros matching the optional regular expression. If no regex is given, list all.
:delmac :delmacros
Delete recorded macros matching a regular expression.
@ @@ :play
Plays the contents of macro {0-9a-z}.
@@ replays a previous executed macro.
:play {arg} plays a recorded macro.
Using scripts | using-scripts |
:so :source
Read Ex commands from {file}. 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
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.
Profiling | profiling profile |
:time
Profile a piece of code or a command. Run {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.