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

Add :map <silent>

This commit is contained in:
Kris Maglione
2008-10-15 02:09:05 +00:00
parent 1394f483e4
commit 9f22a91b64
3 changed files with 97 additions and 65 deletions

View File

@@ -170,14 +170,15 @@ function Mappings() //{{{
// 2 args -> map arg1 to arg*
function map(args, mode, noremap)
{
if (!args)
if (!args.arguments.length)
{
mappings.list(mode);
return;
}
// ?:\s+ <- don't remember; (...)? optional = rhs
var [, lhs, rhs] = args.match(/(\S+)(?:\s+(.+))?/);
let [lhs] = args.arguments;
let rhs = args.literalArg;
if (!rhs) // list the mapping
{
@@ -189,11 +190,11 @@ function Mappings() //{{{
{
mappings.addUserMap([m], [lhs],
"User defined mapping",
function (count) { events.feedkeys((count > 1 ? count : "") + rhs, noremap); },
function (count) { events.feedkeys((count > 1 ? count : "") + rhs, noremap, "<silent>" in args); },
{
flags: Mappings.flags.COUNT,
rhs: rhs,
noremap: noremap
noremap: noremap,
});
}
}
@@ -201,10 +202,19 @@ function Mappings() //{{{
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";
const opts = {
completer: function (filter) completion.userMapping(filter, modes),
options: [
[["<silent>", "<Silent>"], commands.OPTION_NOARG]
],
argCount: 1,
literal: true
};
commands.add([ch ? ch + "m[ap]" : "map"],
"Map a key sequence" + modeDescription,
function (args) { map(args, modes, false); },
{ completer: function (filter) completion.userMapping(filter, modes) });
opts);
commands.add([ch + "no[remap]"],
"Map a key sequence without remapping keys" + modeDescription,