mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 07:08:00 +01:00
Serialize the -group flag to :abbreviate with :mkp.
This commit is contained in:
@@ -227,6 +227,10 @@ var Abbreviations = Module("abbreviations", {
|
||||
*/), "x", params);
|
||||
},
|
||||
|
||||
get allHives() contexts.allGroups.abbrevs,
|
||||
|
||||
get userHives() this.allHives.filter(h => h !== this.builtin),
|
||||
|
||||
get: deprecated("group.abbrevs.get", { get: function get() this.user.closure.get }),
|
||||
set: deprecated("group.abbrevs.set", { get: function set() this.user.closure.set }),
|
||||
remove: deprecated("group.abbrevs.remove", { get: function remove() this.user.closure.remove }),
|
||||
@@ -257,7 +261,7 @@ var Abbreviations = Module("abbreviations", {
|
||||
* @optional
|
||||
*/
|
||||
list: function (modes, lhs, hives) {
|
||||
let hives = hives || contexts.allGroups.abbrevs.filter(h => !h.empty);
|
||||
let hives = (hives || this.userHives).filter(h => !h.empty);
|
||||
|
||||
function abbrevs(hive)
|
||||
hive.merged.filter(ab => (ab.inModes(modes) && ab.lhs.indexOf(lhs) == 0));
|
||||
@@ -341,18 +345,22 @@ var Abbreviations = Module("abbreviations", {
|
||||
description: "Expand this abbreviation by evaluating its right-hand-side as JavaScript"
|
||||
}
|
||||
],
|
||||
serialize: function () [
|
||||
serialize: function () array(abbreviations.userHives)
|
||||
.filter(h => h.persist)
|
||||
.map(hive => [
|
||||
{
|
||||
command: this.name,
|
||||
arguments: [abbr.lhs],
|
||||
literalArg: abbr.rhs,
|
||||
options: {
|
||||
"-group": hive.name == "user" ? undefined : hive.name,
|
||||
"-javascript": callable(abbr.rhs) ? null : undefined
|
||||
}
|
||||
}
|
||||
for ([, abbr] in Iterator(abbreviations.user.merged))
|
||||
for ([, abbr] in Iterator(hive.merged))
|
||||
if (abbr.modesEqual(modes))
|
||||
]
|
||||
]).
|
||||
flatten().array
|
||||
});
|
||||
|
||||
commands.add([ch + "una[bbreviate]"],
|
||||
|
||||
@@ -284,12 +284,13 @@
|
||||
<p>
|
||||
In addition to its own JavaScript context, each script is executed
|
||||
with its own default <link topic="groups">group</link> into which
|
||||
its styles, mappings, commands, and autocommands are placed. This
|
||||
means that commands such as <ex>:delcommand!</ex> can be issued
|
||||
without fear of trampling other user-defined mappings. The command
|
||||
<ex>:group! default</ex> can be issued to clear all such items at
|
||||
once, and should be placed at the head of most scripts to prevent
|
||||
the accumulation of stale items when the script is re-sourced.
|
||||
its styles, mappings, commands, abbreviations and autocommands are
|
||||
placed. This means that commands such as <ex>:delcommand!</ex> can
|
||||
be issued without fear of trampling other user-defined mappings.
|
||||
The command <ex>:group! default</ex> can be issued to clear all
|
||||
such items at once, and should be placed at the head of most
|
||||
scripts to prevent the accumulation of stale items when the script
|
||||
is re-sourced.
|
||||
</p>
|
||||
|
||||
<h3 tag=":source-css">Cascading Stylesheets</h3>
|
||||
|
||||
Reference in New Issue
Block a user