From 06936c88ea9d1663a18191f15ff0cd3b784cbef1 Mon Sep 17 00:00:00 2001
From: Kris Maglione Sorry, no help available.{ br + template.map(ary, function ([a, b]) <>
- >;
+ function add(ary) {
+ res.item.description.* += br +
+ let (br = br + <> >)
+ <>{ br + template.map(ary, function ([a, b]) <>
+ >;
+ }
+
+ if (obj.completer)
+ add(completion._runCompleter(obj.completer, "", null, args).items
+ .map(function (i) [i.text, i.description]));
+
+ if (obj.options && obj.options.some(function (o) o.description))
+ add(obj.options.filter(function (o) o.description)
+ .map(function (o) [
+ o.names[0],
+ <>{o.description}{
+ o.names.length == 1 ? "" :
+ <> (short name: {
+ template.map(o.names.slice(1), function (n) {n}, <>, >)
+ })>
+ }>
+ ]));
}
-
- if (obj.completer)
- add(completion._runCompleter(obj.completer, "", null, args).items
- .map(function (i) [i.text, i.description]));
-
- if (obj.options && obj.options.some(function (o) o.description))
- add(obj.options.filter(function (o) o.description)
- .map(function (o) [
- o.names[0],
- <>{o.description}{
- o.names.length == 1 ? "" :
- <> (short name: {
- template.map(o.names.slice(1), function (n) {n}, <>, >)
- })>
- }>
- ]));
- return res.*.toXMLString().replace(/^ {12}|[ \t]+$/gm, "");
+ return res.*.toXMLString().replace(/^ {12}|[ \t]+$/gm, "").replace(/^.*\n|\n.*$/g, "") + "\n";
},
/**
@@ -1764,9 +1772,9 @@ const Dactyl = Module("dactyl", {
commands.add(["norm[al]"],
"Execute Normal mode commands",
- function (args) { events.feedkeys(args[0] || "", args.bang, false, modes.NORMAL); },
+ function (args) { events.feedkeys(args[0], args.bang, false, modes.NORMAL); },
{
- argCount: "+",
+ argCount: "1",
bang: true,
literal: 0
});
diff --git a/common/content/mappings.js b/common/content/mappings.js
index 816eb214..48627f80 100644
--- a/common/content/mappings.js
+++ b/common/content/mappings.js
@@ -419,15 +419,12 @@ const Mappings = Module("mappings", {
names: ["-javascript", "-js", "-j"],
description: "Execute this mapping as JavaScript rather than keys"
},
- {
+ update({}, modeFlag, {
names: ["-modes", "-mode", "-m"],
type: CommandOption.LIST,
description: "Create this mapping in the given modes",
default: mapmodes || ["n", "v"],
- validator: function (list) !list || list.every(findMode),
- completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.disp]
- for (mode in values(modes.all))],
- },
+ }),
{
names: ["-nopersist", "-n"],
description: "Do not save this mapping to an auto-generated RC file"
@@ -501,10 +498,20 @@ const Mappings = Module("mappings", {
});
}
+ let modeFlag = {
+ names: ["-mode", "-m"],
+ type: CommandOption.STRING,
+ validator: function (value) Array.concat(value).every(findMode),
+ completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.disp]
+ for (mode in values(modes.all))],
+ };
+
function findMode(name) {
- for (let mode in values(modes.all))
- if (name == mode || name == mode.char || String.toLowerCase(name).replace(/-/g, "_") == mode.name.toLowerCase())
- return mode.mask;
+ if (name)
+ for (let mode in values(modes.all))
+ if (name == mode || name == mode.char
+ || String.toLowerCase(name).replace(/-/g, "_") == mode.name.toLowerCase())
+ return mode.mask;
return null;
}
function uniqueModes(modes) {
@@ -514,6 +521,20 @@ const Mappings = Module("mappings", {
return array.uniq(modes.filter(function (m) chars.indexOf(m.char) < 0).concat(chars));
}
+ commands.add(["feedkeys", "fk"],
+ "Fake key events",
+ function (args) { events.feedkeys(args[0] || "", args.bang, false, findMode(args["-mode"])); },
+ {
+ argCount: "1",
+ bang: true,
+ literal: 0,
+ options: [
+ update({}, modeFlag, {
+ description: "The in which to feed the keys"
+ })
+ ]
+ });
+
addMapCommands("", [modes.NORMAL, modes.VISUAL], "");
let args = {
@@ -540,15 +561,10 @@ const Mappings = Module("mappings", {
name: ["listk[eys]", "lk"],
description: "List all mappings along with their short descriptions",
options: [
- {
- names: ["-mode", "-m"],
- type: CommandOption.STRING,
- description: "The mode for which to list mappings",
+ update({}, modeFlag, {
default: "n",
- completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.disp]
- for (mode in values(modes.all))],
- validator: function (m) findMode(m)
- }
+ description: "The mode for which to list mappings"
+ })
]
});
diff --git a/common/locale/en-US/index.xml b/common/locale/en-US/index.xml
index 343638a8..26a616e7 100644
--- a/common/locale/en-US/index.xml
+++ b/common/locale/en-US/index.xml
@@ -255,6 +255,7 @@ This file contains a list of all available commands, mappings and options.
Fake key events.
+ +