VI emulator with jquery
Jqvi is a emulator for the unix vi text editor. Not all of the features are present yet, but hopefully soon they will be.
Jqvi is relatively easy to use. In the most basic case all you would need is:
// Fullscreen emulation
$("body").jqvi();
/* OR */
// Modular emulation
$(".jqvi_wrapper").jqvi();
the name of the text file that vi will be opening.
$("body").jqvi({
filename : 'example.txt',
});
A string containg the text for the file. Each line should be separated by p tags (no other html tags should be used here).
If this option is omitted, then
$("body").jqvi({
fileText : "<p>one</p><p>two</p><p>three</p><p>four</p>",
});
A javascript object that contains folder information that the file will be written to. The file will be written into the {foldername}._files child object.
If this is omitted, it will be written to an empty object.
var files = {
examples : {
_files : {}
},
_files : {},
}
$("body").jqvi({
filesystem : files.examples,
});
The callback function to be run once vi is closed (like with :q or :wq).
If this is omitted than it will just become a blank screen.
$("body").jqvi({
unloadCallback : function() {
alert("vi has been closed.");
}
},
});