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:
@@ -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],
|
||||||
|
|||||||
Reference in New Issue
Block a user