I achieved this by involving the ace editor.
Assume you have the jQuery plugin and the simple theme plugin installed then you could add this script:
Q(function() {
// Append the ace editor script. Change it to your script location
Q('body').append('<script src="/userContent/ace/src/ace.js">');
// Search the textarea
Q('textarea[name="command"]').each(function(index, textarea) {
textarea = Q(textarea);
id = 'editor_' + index
// Hide the original textarea
textarea.hide();
// Create the editor div
textarea.after('<div id="' + id + '"/>');
// Setup the editor
var editor = ace.edit(id);
editor.setOptions({
maxLines: Infinity,
minLines: 5,
});
editor.getSession().setMode('ace/mode/sh');
// Set initial value and create the event handler
editor.getSession().setValue(textarea.val());
editor.getSession().on('change', function() {
textarea.val(editor.getSession().getValue());
});
});
});