1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-23 20:45:45 +01:00

Match Vim's behaviour with <Nop> in the RHS of a mapping.

<Nop> is not remapped if it is the complete RHS of a mapping otherwise
it behaves like any other key.
This commit is contained in:
Doug Kearns
2009-07-11 00:14:13 +10:00
parent 1f7b6f4b05
commit 18bf61c1e0

View File

@@ -221,13 +221,16 @@ function Mappings() //{{{
return; return;
} }
// ?:\s+ <- don't remember; (...)? optional = rhs
let [lhs, rhs] = args; let [lhs, rhs] = args;
if (!rhs) // list the mapping if (!rhs) // list the mapping
mappings.list(mode, expandLeader(lhs)); mappings.list(mode, expandLeader(lhs));
else else
{ {
// this matches Vim's behaviour
if (/^<Nop>$/i.test(rhs))
noremap = true;
for (let [,m] in Iterator(mode)) for (let [,m] in Iterator(mode))
{ {
mappings.addUserMap([m], [lhs], mappings.addUserMap([m], [lhs],