1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 09:27:58 +01:00

Kill 'mapleader'.

This commit is contained in:
Kris Maglione
2012-02-01 09:51:00 -05:00
parent 7e3868c15e
commit c4b52258b7
7 changed files with 12 additions and 53 deletions

View File

@@ -372,8 +372,6 @@ var Events = Module("events", {
if (quiet) if (quiet)
commandline.quiet = quiet; commandline.quiet = quiet;
keys = mappings.expandLeader(keys);
for (let [, evt_obj] in Iterator(DOM.Event.parse(keys))) { for (let [, evt_obj] in Iterator(DOM.Event.parse(keys))) {
let now = Date.now(); let now = Date.now();
let key = DOM.Event.stringify(evt_obj); let key = DOM.Event.stringify(evt_obj);

View File

@@ -722,7 +722,7 @@ var HintSession = Class("HintSession", CommandMode, {
* Display the current status to the user. * Display the current status to the user.
*/ */
updateStatusline: function _updateStatusline() { updateStatusline: function _updateStatusline() {
statusline.inputBuffer = (this.escapeNumbers ? options["mapleader"] : "") + statusline.inputBuffer = (this.escapeNumbers ? "\\" : "") +
(this.hintNumber ? this.getHintString(this.hintNumber) : ""); (this.hintNumber ? this.getHintString(this.hintNumber) : "");
}, },
}); });
@@ -1266,7 +1266,7 @@ var Hints = Module("hints", {
"Delete the previous character", "Delete the previous character",
function ({ self }) self.backspace()); function ({ self }) self.backspace());
bind(["<Leader>"], bind(["\\"],
"Toggle hint filtering", "Toggle hint filtering",
function ({ self }) { self.escapeNumbers = !self.escapeNumbers; }); function ({ self }) { self.escapeNumbers = !self.escapeNumbers; });
}, },

View File

@@ -355,7 +355,7 @@ var Mappings = Module("mappings", {
get userHives() this.allHives.filter(function (h) h !== this.builtin, this), get userHives() this.allHives.filter(function (h) h !== this.builtin, this),
expandLeader: function expandLeader(keyString) keyString.replace(/<Leader>/i, function () options["mapleader"]), expandLeader: deprecated("your brain", function expandLeader(keyString) keyString),
prefixes: Class.Memoize(function () { prefixes: Class.Memoize(function () {
let list = Array.map("CASM", function (s) s + "-"); let list = Array.map("CASM", function (s) s + "-");
@@ -365,8 +365,6 @@ var Mappings = Module("mappings", {
}), }),
expand: function expand(keys) { expand: function expand(keys) {
keys = keys.replace(/<leader>/i, options["mapleader"]);
if (!/<\*-/.test(keys)) if (!/<\*-/.test(keys))
var res = keys; var res = keys;
else else
@@ -541,7 +539,7 @@ var Mappings = Module("mappings", {
args["-builtin"] = true; args["-builtin"] = true;
if (!rhs) // list the mapping if (!rhs) // list the mapping
mappings.list(mapmodes, mappings.expandLeader(lhs), hives); mappings.list(mapmodes, lhs, hives);
else { else {
util.assert(args["-group"].modifiable, util.assert(args["-group"].modifiable,
_("map.builtinImmutable")); _("map.builtinImmutable"));
@@ -828,18 +826,10 @@ var Mappings = Module("mappings", {
function (context, obj, args) [[m.names, m.description] for (m in this.iterate(args[0]))] function (context, obj, args) [[m.names, m.description] for (m in this.iterate(args[0]))]
]); ]);
}, },
options: function initOptions(dactyl, modules, window) { mappings: function initMappings(dactyl, modules, window) {
options.add(["mapleader", "ml"], mappings.add([modes.COMMAND],
"Define the replacement keys for the <Leader> pseudo-key", ["\\"], "Emits <Leader> pseudo-key",
"string", "\\", { function () { events.feedkeys("<Leader>") });
setter: function (value) {
if (this.hasChanged)
for (let hive in values(mappings.allHives))
for (let stack in values(hive.stacks))
delete stack.states;
return value;
}
});
} }
}); });

View File

@@ -48,7 +48,7 @@
<dt><k name="Tab"/></dt> <dt><k name="Tab"/></dt>
<dd>Moves the focus to the next hintable element</dd> <dd>Moves the focus to the next hintable element</dd>
<dt><k name="Leader"/></dt> <dt><k>\</k></dt>
<dd>Temporarily treats all numbers (or other keys, depending on the <dd>Temporarily treats all numbers (or other keys, depending on the
value of <o>hintkeys</o>) as ordinary text</dd> value of <o>hintkeys</o>) as ordinary text</dd>

View File

@@ -395,25 +395,6 @@
</description> </description>
</item> </item>
<item>
<tags><![CDATA[<Leader> \]]></tags>
<strut/>
<spec><![CDATA[<Leader>]]></spec>
<description>
<p>
A pseudo-key which expands to the value of the <o>mapleader</o>
option. For example, by default,
</p>
<code><ex>:map <k name="Leader"/>h</ex> <ex>:echo <str>Hello</str><k name="CR"/></ex></code>
<p>works like</p>
<code><ex>:map \h</ex> <ex>:echo <str>Hello</str><k name="CR"/></ex></code>
<p>but after</p>
<set opt="mapleader"><str>,</str></set>
<p>it works like</p>
<code><ex>:map ,h</ex> <ex>:echo <str>Hello</str><k name="CR"/></ex></code>
</description>
</item>
<h3 tag="map-examples">Mapping examples</h3> <h3 tag="map-examples">Mapping examples</h3>
<p>Make <k name="A-n" link="false"/> do the same as <k name="Down" link="false"/> in input <t>modes</t>:</p> <p>Make <k name="A-n" link="false"/> do the same as <k name="Down" link="false"/> in input <t>modes</t>:</p>

View File

@@ -694,7 +694,7 @@
<strut/> <strut/>
<type>&option.extendedhinttags.type;</type> <type>&option.extendedhinttags.type;</type>
<default>[asOTvVWy]:':-moz-any-link',area[href],img[src],iframe[src], <default>[asOTvVWy]:':-moz-any-link',area[href],img[src],iframe[src],
[A]:[id], [A]:[id],a[name],
[f]:body, [f]:body,
[F]:body,code,div,html,p,pre,span, [F]:body,code,div,html,p,pre,span,
[iI]:img, [iI]:img,
@@ -1116,16 +1116,6 @@
</description> </description>
</item> </item>
<item>
<tags>'ml' 'mapleader'</tags>
<spec>'mapleader' 'ml'</spec>
<type>&option.mapleader.type;</type>
<default>&option.mapleader.default;</default>
<description>
<p>Defines the replacement keys for the <k name="Leader"/> pseudo-key.</p>
</description>
</item>
<item> <item>
<tags>'maxitems'</tags> <tags>'maxitems'</tags>
<spec>'maxitems'</spec> <spec>'maxitems'</spec>

View File

@@ -217,8 +217,8 @@
still be used for this purpose. [b4] still be used for this purpose. [b4]
- 'loadplugins' is now a [regexplist] option rather than - 'loadplugins' is now a [regexplist] option rather than
a boolean. [b2] a boolean. [b2]
- 'mapleader' is now an option rather than a :let - 'mapleader' is no longer an option rather or a :let
variable. [b4] variable. [b4][rc2]
- 'passkeys' is now a [sitemap] with key chain support rather - 'passkeys' is now a [sitemap] with key chain support rather
than a [regexpmap]. [b6] than a [regexpmap]. [b6]
- The precise format of 'sanitizeitems' has changed slightly. [b8] - The precise format of 'sanitizeitems' has changed slightly. [b8]