// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
-/* use strict */
+"use strict";
/** @scope modules */
return cmds;
}
- XML.prettyPrinting = XML.ignoreWhitespace = false;
- commandline.commandOutput(
- <table>
- <tr highlight="Title">
- <td colspan="3">----- Auto Commands -----</td>
- </tr>
- {
- template.map(hives, function (hive)
- <tr>
- <td colspan="3"><span highlight="Title">{hive.name}</span>
- {hive.filter}</td>
- </tr> +
- <tr style="height: .5ex;"/> +
- template.map(cmds(hive), function ([event, items])
- <tr style="height: .5ex;"/> +
- template.map(items, function (item, i)
- <tr>
- <td highlight="Title" style="padding-left: 1em; padding-right: 1em;">{i == 0 ? event : ""}</td>
- <td>{item.filter.toXML ? item.filter.toXML() : item.filter}</td>
- <td>{item.command}</td>
- </tr>) +
- <tr style="height: .5ex;"/>) +
- <tr style="height: .5ex;"/>)
- }
- </table>);
+ let table = (
+ ["table", {},
+ ["tr", { highlight: "Title" },
+ ["td", { colspan: "3" }, "----- Auto Commands -----"]],
+ hives.map(function (hive) [
+ ["tr", {},
+ ["td", { colspan: "3" },
+ ["span", { highlight: "Title" }, hive.name],
+ " ", hive.filter.toJSONXML(modules)]],
+ ["tr", { style: "height: .5ex;" }],
+ iter(cmds(hive)).map(function ([event, items]) [
+ ["tr", { style: "height: .5ex;" }],
+ items.map(function (item, i)
+ ["tr", {},
+ ["td", { highlight: "Title", style: "padding-left: 1em; padding-right: 1em;" },
+ i == 0 ? event : ""],
+ ["td", {}, item.filter.toJSONXML ? item.filter.toJSONXML(modules) : String(item.filter)],
+ ["td", {}, String(item.command)]]),
+ ["tr", { style: "height: .5ex;" }]]).toArray(),
+ ["tr", { style: "height: .5ex;" }],
+ ])]);
+ commandline.commandOutput(table);
},
/**
}
}, {
}, {
- contexts: function () {
+ contexts: function initContexts() {
update(AutoCommands.prototype, {
hives: contexts.Hives("autocmd", AutoCmdHive),
user: contexts.hives.autocmd.user,
matchingHives: function matchingHives(uri, doc) contexts.matchingGroups(uri, doc).autocmd
});
},
- commands: function () {
+ commands: function initCommands() {
commands.add(["au[tocmd]"],
"Execute commands automatically on events",
function (args) {
});
});
},
- completion: function () {
+ completion: function initCompletion() {
completion.autocmdEvent = function autocmdEvent(context) {
context.completions = Iterator(config.autocommands);
};
},
- javascript: function () {
+ javascript: function initJavascript() {
JavaScript.setCompleter(AutoCmdHive.prototype.get, [function () Iterator(config.autocommands)]);
},
- options: function () {
+ options: function initOptions() {
options.add(["eventignore", "ei"],
"List of autocommand event names which should be ignored",
"stringlist", "",