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

fix :map and :noremap to work with new multi-mode mappings

This commit is contained in:
Doug Kearns
2007-09-11 04:09:15 +00:00
parent c13127eb0b
commit 9468bf8301
2 changed files with 6 additions and 5 deletions

View File

@@ -603,7 +603,7 @@ function Commands() //{{{
if (rhs) if (rhs)
{ {
vimperator.mappings.add(new Map(vimperator.modes.NORMAL, [lhs], vimperator.mappings.add(new Map([vimperator.modes.NORMAL], [lhs],
function() { vimperator.events.feedkeys(rhs); }, { rhs: rhs } function() { vimperator.events.feedkeys(rhs); }, { rhs: rhs }
)); ));
} }
@@ -730,7 +730,7 @@ function Commands() //{{{
if (/^:/.test(rhs)) if (/^:/.test(rhs))
{ {
vimperator.mappings.add( vimperator.mappings.add(
new Map(vimperator.modes.NORMAL, [lhs], function() { vimperator.execute(rhs); }, { rhs: rhs }) new Map([vimperator.modes.NORMAL], [lhs], function() { vimperator.execute(rhs); }, { rhs: rhs })
); );
} }
else else
@@ -745,7 +745,7 @@ function Commands() //{{{
// is created not at runtime // is created not at runtime
if (map) if (map)
vimperator.mappings.add( vimperator.mappings.add(
new Map(vimperator.modes.NORMAL, [lhs], map.action, { flags: map.flags, rhs: rhs }) new Map([vimperator.modes.NORMAL], [lhs], map.action, { flags: map.flags, rhs: rhs })
); );
else else
vimperator.echoerr("E475: Invalid argument: " + "{rhs} must be a existing singular mapping"); vimperator.echoerr("E475: Invalid argument: " + "{rhs} must be a existing singular mapping");

View File

@@ -212,10 +212,11 @@ function Mappings() //{{{
for (var i = 0; i < map.names.length; i++) for (var i = 0; i < map.names.length; i++)
{ {
for (var j = 0; j < map.modes.length; j++) for (var j = 0; j < map.modes.length; j++)
removeMap(map.modes[0], map.names[i]); removeMap(map.modes[j], map.names[i]);
} }
user[map.mode].push(map); for (var k = 0; k < map.modes.length; k++)
user[map.modes[k]].push(map);
} }
this.remove = function(mode, cmd) this.remove = function(mode, cmd)