// Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2010 by anekos <anekos@snca.net>
-// Copyright (c) 2010-2011 by Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2010-2012 Kris Maglione <maglione.k at Gmail>
//
// 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 */
nonkeyword: /[ "']/
};
- this._match = util.regexp(<><![CDATA[
+ this._match = util.regexp(literal(/*
(^ | \s | <nonkeyword>) (<keyword>+ )$ | // full-id
(^ | \s | <keyword> ) (<nonkeyword>+ <keyword>)$ | // end-id
(^ | \s ) (\S* <nonkeyword> )$ // non-id
- ]]></>, "x", params);
- this._check = util.regexp(<><![CDATA[
+ */), "x", params);
+ this._check = util.regexp(literal(/*
^ (?:
<keyword>+ | // full-id
<nonkeyword>+ <keyword> | // end-id
\S* <nonkeyword> // non-id
) $
- ]]></>, "x", params);
+ */), "x", params);
},
get: deprecated("group.abbrevs.get", { get: function get() this.user.closure.get }),
function abbrevs(hive)
hive.merged.filter(function (abbr) (abbr.inModes(modes) && abbr.lhs.indexOf(lhs) == 0));
- let list = <table>
- <tr highlight="Title">
- <td/>
- <td style="padding-right: 1em;">{_("title.Mode")}</td>
- <td style="padding-right: 1em;">{_("title.Abbrev")}</td>
- <td style="padding-right: 1em;">{_("title.Replacement")}</td>
- </tr>
- <col style="min-width: 6em; padding-right: 1em;"/>
- {
- template.map(hives, function (hive) let (i = 0)
- <tr style="height: .5ex;"/> +
- template.map(abbrevs(hive), function (abbrev)
- <tr>
- <td highlight="Title">{!i++ ? hive.name : ""}</td>
- <td>{abbrev.modeChar}</td>
- <td>{abbrev.lhs}</td>
- <td>{abbrev.rhs}</td>
- </tr>) +
- <tr style="height: .5ex;"/>)
- }
- </table>;
-
- // TODO: Move this to an ItemList to show this automatically
- if (list.*.length() === list.text().length() + 2)
- dactyl.echomsg(_("abbreviation.none"));
- else
- commandline.commandOutput(list);
+ let list = ["table", {},
+ ["tr", { highlight: "Title" },
+ ["td"],
+ ["td", { style: "padding-right: 1em;" }, _("title.Mode")],
+ ["td", { style: "padding-right: 1em;" }, _("title.Abbrev")],
+ ["td", { style: "padding-right: 1em;" }, _("title.Replacement")]],
+ ["col", { style: "min-width: 6em; padding-right: 1em;" }],
+ hives.map(function (hive) let (i = 0) [
+ ["tr", { style: "height: .5ex;" }],
+ abbrevs(hive).map(function (abbrev)
+ ["tr", {},
+ ["td", { highlight: "Title" }, !i++ ? String(hive.name) : ""],
+ ["td", {}, abbrev.modeChar],
+ ["td", {}, abbrev.lhs],
+ ["td", {}, abbrev.rhs]]),
+ ["tr", { style: "height: .5ex;" }]])];
+
+ // FIXME?
+ // // TODO: Move this to an ItemList to show this automatically
+ // if (list.*.length() === list.text().length() + 2)
+ // dactyl.echomsg(_("abbreviation.none"));
+ // else
+ commandline.commandOutput(list);
}
}, {
user: contexts.hives.abbrevs.user
});
},
- completion: function () {
+ completion: function initCompletion() {
completion.abbreviation = function abbreviation(context, modes, group) {
group = group || abbreviations.user;
let fn = modes ? function (abbr) abbr.inModes(modes) : util.identity;
context.completions = group.merged.filter(fn);
};
},
- commands: function () {
+ commands: function initCommands() {
function addAbbreviationCommands(modes, ch, modeDescription) {
modes.sort();
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";