mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 16:37:58 +01:00
Split Map.flags into individual properties of Map.
This commit is contained in:
@@ -811,22 +811,22 @@ function History() //{{{
|
||||
mappings.add(myModes,
|
||||
["<C-o>"], "Go to an older position in the jump list",
|
||||
function (count) { history.stepTo(-Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes,
|
||||
["<C-i>"], "Go to a newer position in the jump list",
|
||||
function (count) { history.stepTo(Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes,
|
||||
["H", "<A-Left>", "<M-Left>"], "Go back in the browser history",
|
||||
function (count) { history.stepTo(-Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes,
|
||||
["L", "<A-Right>", "<M-Right>"], "Go forward in the browser history",
|
||||
function (count) { history.stepTo(Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||
@@ -1064,7 +1064,7 @@ function QuickMarks() //{{{
|
||||
mappings.add(myModes,
|
||||
["go"], "Jump to a QuickMark",
|
||||
function (arg) { quickmarks.jumpTo(arg, liberator.CURRENT_TAB); },
|
||||
{ flags: Mappings.flags.ARGUMENT });
|
||||
{ arg: true });
|
||||
|
||||
mappings.add(myModes,
|
||||
["gn"], "Jump to a QuickMark in a new tab",
|
||||
@@ -1074,7 +1074,7 @@ function QuickMarks() //{{{
|
||||
/\bquickmark\b/.test(options["activate"]) ?
|
||||
liberator.NEW_TAB : liberator.NEW_BACKGROUND_TAB);
|
||||
},
|
||||
{ flags: Mappings.flags.ARGUMENT });
|
||||
{ arg: true });
|
||||
|
||||
mappings.add(myModes,
|
||||
["M"], "Add new QuickMark for current URL",
|
||||
@@ -1085,7 +1085,7 @@ function QuickMarks() //{{{
|
||||
|
||||
quickmarks.add(arg, buffer.URL);
|
||||
},
|
||||
{ flags: Mappings.flags.ARGUMENT });
|
||||
{ arg: true });
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||
|
||||
@@ -204,7 +204,7 @@ function Buffer() //{{{
|
||||
mappings.repeat();
|
||||
}
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["i", "<Insert>"],
|
||||
"Start caret mode",
|
||||
@@ -223,22 +223,22 @@ function Buffer() //{{{
|
||||
mappings.add(myModes, ["j", "<Down>", "<C-e>"],
|
||||
"Scroll document down",
|
||||
function (count) { buffer.scrollLines(Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["k", "<Up>", "<C-y>"],
|
||||
"Scroll document up",
|
||||
function (count) { buffer.scrollLines(-Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, liberator.has("mail") ? ["h"] : ["h", "<Left>"],
|
||||
"Scroll document to the left",
|
||||
function (count) { buffer.scrollColumns(-Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, liberator.has("mail") ? ["l"] : ["l", "<Right>"],
|
||||
"Scroll document to the right",
|
||||
function (count) { buffer.scrollColumns(Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["0", "^"],
|
||||
"Scroll to the absolute left of the document",
|
||||
@@ -251,12 +251,12 @@ function Buffer() //{{{
|
||||
mappings.add(myModes, ["gg", "<Home>"],
|
||||
"Go to the top of the document",
|
||||
function (count) { buffer.scrollToPercentiles(buffer.scrollXPercent, Math.max(count, 0)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["G", "<End>"],
|
||||
"Go to the end of the document",
|
||||
function (count) { buffer.scrollToPercentiles(buffer.scrollXPercent, count >= 0 ? count : 100); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["%"],
|
||||
"Scroll to {count} percent of the document",
|
||||
@@ -267,7 +267,7 @@ function Buffer() //{{{
|
||||
else
|
||||
liberator.beep();
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
function scrollByScrollSize(count, direction)
|
||||
{
|
||||
@@ -279,42 +279,42 @@ function Buffer() //{{{
|
||||
mappings.add(myModes, ["<C-d>"],
|
||||
"Scroll window downwards in the buffer",
|
||||
function (count) { scrollByScrollSize(count, true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["<C-u>"],
|
||||
"Scroll window upwards in the buffer",
|
||||
function (count) { scrollByScrollSize(count, false); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["<C-b>", "<PageUp>", "<S-Space>"],
|
||||
"Scroll up a full page",
|
||||
function (count) { buffer.scrollPages(-Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["<C-f>", "<PageDown>", "<Space>"],
|
||||
"Scroll down a full page",
|
||||
function (count) { buffer.scrollPages(Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["]f"],
|
||||
"Focus next frame",
|
||||
function (count) { buffer.shiftFrameFocus(Math.max(count, 1), true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["[f"],
|
||||
"Focus previous frame",
|
||||
function (count) { buffer.shiftFrameFocus(Math.max(count, 1), false); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["]]"],
|
||||
"Follow the link labeled 'next' or '>' if it exists",
|
||||
function (count) { buffer.followDocumentRelationship("next"); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["[["],
|
||||
"Follow the link labeled 'prev', 'previous' or '<' if it exists",
|
||||
function (count) { buffer.followDocumentRelationship("previous"); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["gf"],
|
||||
"View source",
|
||||
@@ -366,7 +366,7 @@ function Buffer() //{{{
|
||||
liberator.beep();
|
||||
}
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["gP"],
|
||||
"Open (put) a URL based on the current clipboard contents in a new buffer",
|
||||
@@ -424,58 +424,58 @@ function Buffer() //{{{
|
||||
mappings.add(myModes, ["zi", "+"],
|
||||
"Enlarge text zoom of current web page",
|
||||
function (count) { buffer.zoomIn(Math.max(count, 1), false); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["zm"],
|
||||
"Enlarge text zoom of current web page by a larger amount",
|
||||
function (count) { buffer.zoomIn(Math.max(count, 1) * 3, false); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["zo", "-"],
|
||||
"Reduce text zoom of current web page",
|
||||
function (count) { buffer.zoomOut(Math.max(count, 1), false); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["zr"],
|
||||
"Reduce text zoom of current web page by a larger amount",
|
||||
function (count) { buffer.zoomOut(Math.max(count, 1) * 3, false); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["zz"],
|
||||
"Set text zoom value of current web page",
|
||||
function (count) { buffer.textZoom = count > 1 ? count : 100; },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["zI"],
|
||||
"Enlarge full zoom of current web page",
|
||||
function (count) { buffer.zoomIn(Math.max(count, 1), true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["zM"],
|
||||
"Enlarge full zoom of current web page by a larger amount",
|
||||
function (count) { buffer.zoomIn(Math.max(count, 1) * 3, true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["zO"],
|
||||
"Reduce full zoom of current web page",
|
||||
function (count) { buffer.zoomOut(Math.max(count, 1), true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["zR"],
|
||||
"Reduce full zoom of current web page by a larger amount",
|
||||
function (count) { buffer.zoomOut(Math.max(count, 1) * 3, true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["zZ"],
|
||||
"Set full zoom value of current web page",
|
||||
function (count) { buffer.fullZoom = count > 1 ? count : 100; },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
// page info
|
||||
mappings.add(myModes, ["<C-g>"],
|
||||
"Print the current file name",
|
||||
function (count) { buffer.showPageInfo(false); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["g<C-g>"],
|
||||
"Print file information",
|
||||
@@ -1732,12 +1732,12 @@ function Marks() //{{{
|
||||
|
||||
marks.add(arg);
|
||||
},
|
||||
{ flags: Mappings.flags.ARGUMENT });
|
||||
{ arg: true });
|
||||
|
||||
mappings.add(myModes,
|
||||
["'", "`"], "Jump to the mark in the current buffer",
|
||||
function (arg) { marks.jumpTo(arg); },
|
||||
{ flags: Mappings.flags.ARGUMENT });
|
||||
{ arg: true });
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||
|
||||
@@ -970,7 +970,7 @@ function Commands() //{{{
|
||||
else
|
||||
liberator.echoerr("E30: No previous command line");
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
|
||||
@@ -114,7 +114,7 @@ function Editor() //{{{
|
||||
{
|
||||
let extraInfo = {};
|
||||
if (hasCount)
|
||||
extraInfo.flags = Mappings.flags.COUNT;
|
||||
extraInfo.count = true;
|
||||
|
||||
mappings.add([modes.CARET], keys, "",
|
||||
function (count)
|
||||
@@ -178,7 +178,7 @@ function Editor() //{{{
|
||||
mappings.add([modes.TEXTAREA], [key],
|
||||
"Motion command",
|
||||
function (motion, count) { editor.executeCommandWithMotion(key, motion, count); },
|
||||
{ flags: Mappings.flags.MOTION | Mappings.flags.COUNT });
|
||||
{ count: true, motion: true });
|
||||
}
|
||||
|
||||
// For the record, some of this code I've just finished throwing
|
||||
@@ -350,7 +350,7 @@ function Editor() //{{{
|
||||
mappings.add([modes.INSERT],
|
||||
["<Space>", "<Return>"], "Expand insert mode abbreviation",
|
||||
function () { editor.expandAbbreviation("i"); },
|
||||
{ flags: Mappings.flags.ALLOW_EVENT_ROUTING });
|
||||
{ route: true });
|
||||
|
||||
mappings.add([modes.INSERT],
|
||||
["<Tab>"], "Expand insert mode abbreviation",
|
||||
@@ -368,7 +368,7 @@ function Editor() //{{{
|
||||
editor.executeCommand("cmd_undo", count);
|
||||
liberator.mode = modes.TEXTAREA;
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.TEXTAREA],
|
||||
["<C-r>"], "Redo",
|
||||
@@ -377,7 +377,7 @@ function Editor() //{{{
|
||||
editor.executeCommand("cmd_redo", count);
|
||||
liberator.mode = modes.TEXTAREA;
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.TEXTAREA],
|
||||
["D"], "Delete the characters under the cursor until the end of the line",
|
||||
@@ -405,12 +405,12 @@ function Editor() //{{{
|
||||
mappings.add([modes.TEXTAREA],
|
||||
["X"], "Delete character to the left",
|
||||
function (count) { editor.executeCommand("cmd_deleteCharBackward", count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.TEXTAREA],
|
||||
["x"], "Delete character to the right",
|
||||
function (count) { editor.executeCommand("cmd_deleteCharForward", count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
// visual mode
|
||||
mappings.add([modes.CARET, modes.TEXTAREA],
|
||||
@@ -499,7 +499,7 @@ function Editor() //{{{
|
||||
if (pos >= 0)
|
||||
editor.moveToPosition(pos, true, liberator.mode == modes.VISUAL);
|
||||
},
|
||||
{ flags: Mappings.flags.ARGUMENT | Mappings.flags.COUNT });
|
||||
{ arg: true, count: true });
|
||||
|
||||
mappings.add([modes.TEXTAREA, modes.VISUAL],
|
||||
["F"], "Move to a charater on the current line before the cursor",
|
||||
@@ -509,7 +509,7 @@ function Editor() //{{{
|
||||
if (pos >= 0)
|
||||
editor.moveToPosition(pos, false, liberator.mode == modes.VISUAL);
|
||||
},
|
||||
{ flags: Mappings.flags.ARGUMENT | Mappings.flags.COUNT });
|
||||
{ arg: true, count: true });
|
||||
|
||||
mappings.add([modes.TEXTAREA, modes.VISUAL],
|
||||
["t"], "Move before a character on the current line",
|
||||
@@ -519,7 +519,7 @@ function Editor() //{{{
|
||||
if (pos >= 0)
|
||||
editor.moveToPosition(pos - 1, true, liberator.mode == modes.VISUAL);
|
||||
},
|
||||
{ flags: Mappings.flags.ARGUMENT | Mappings.flags.COUNT });
|
||||
{ arg: true, count: true });
|
||||
|
||||
mappings.add([modes.TEXTAREA, modes.VISUAL],
|
||||
["T"], "Move before a character on the current line, backwards",
|
||||
@@ -529,7 +529,7 @@ function Editor() //{{{
|
||||
if (pos >= 0)
|
||||
editor.moveToPosition(pos + 1, false, liberator.mode == modes.VISUAL);
|
||||
},
|
||||
{ flags: Mappings.flags.ARGUMENT | Mappings.flags.COUNT });
|
||||
{ arg: true, count: true });
|
||||
|
||||
// textarea and visual mode
|
||||
mappings.add([modes.TEXTAREA, modes.VISUAL],
|
||||
@@ -555,7 +555,7 @@ function Editor() //{{{
|
||||
}
|
||||
modes.set(modes.TEXTAREA);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||
|
||||
@@ -639,7 +639,7 @@ function Events() //{{{
|
||||
mappings.add([modes.NORMAL, modes.PLAYER, modes.MESSAGE],
|
||||
["q"], "Record a key sequence into a macro",
|
||||
function (arg) { events.startRecording(arg); },
|
||||
{ flags: Mappings.flags.ARGUMENT });
|
||||
{ arg: true });
|
||||
|
||||
mappings.add([modes.NORMAL, modes.PLAYER, modes.MESSAGE],
|
||||
["@"], "Play a macro",
|
||||
@@ -649,7 +649,7 @@ function Events() //{{{
|
||||
while (count-- && events.playMacro(arg))
|
||||
;
|
||||
},
|
||||
{ flags: Mappings.flags.ARGUMENT | Mappings.flags.COUNT });
|
||||
{ arg: true, count: true });
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
@@ -1548,7 +1548,7 @@ function Events() //{{{
|
||||
{
|
||||
map = input.pendingMap;
|
||||
input.pendingMap = null;
|
||||
if (map && map.flags & Mappings.flags.ARGUMENT)
|
||||
if (map && map.arg)
|
||||
input.pendingArgMap = map;
|
||||
}
|
||||
|
||||
@@ -1583,7 +1583,7 @@ function Events() //{{{
|
||||
if (isNaN(input.count))
|
||||
input.count = -1;
|
||||
input.buffer = "";
|
||||
if (map.flags & Mappings.flags.ARGUMENT)
|
||||
if (map.arg)
|
||||
{
|
||||
input.buffer = inputStr;
|
||||
input.pendingArgMap = map;
|
||||
@@ -1595,7 +1595,7 @@ function Events() //{{{
|
||||
input.pendingMotionMap = null;
|
||||
}
|
||||
// no count support for these commands yet
|
||||
else if (map.flags & Mappings.flags.MOTION)
|
||||
else if (map.motion)
|
||||
{
|
||||
input.pendingMotionMap = map;
|
||||
}
|
||||
@@ -1605,7 +1605,7 @@ function Events() //{{{
|
||||
return void killEvent();
|
||||
|
||||
let ret = map.execute(null, input.count);
|
||||
if (map.flags & Mappings.flags.ALLOW_EVENT_ROUTING && ret)
|
||||
if (map.route && ret)
|
||||
stop = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ function Hints() //{{{
|
||||
onChange: function () { modes.pop(); },
|
||||
onCancel: function (arg) { arg && setTimeout(function () hints.show(arg), 0); }
|
||||
});
|
||||
}, { flags: Mappings.flags.COUNT });
|
||||
}, { count: true });
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
|
||||
@@ -59,18 +59,30 @@ function Map(modes, keys, description, action, extraInfo) //{{{
|
||||
this.names = keys.map(events.canonicalKeys);
|
||||
/** @property {function (number)} The function called to execute this mapping. */
|
||||
this.action = action;
|
||||
|
||||
/** @property {number} @see Mappings#flags */
|
||||
// FIXME: flags is incongruent with the other properties
|
||||
this.flags = extraInfo.flags || 0;
|
||||
/** @property {string} This mapping's description, as shown in :viusage. */
|
||||
this.description = description || "";
|
||||
/** @property {string} The literal RHS expansion of this mapping. */
|
||||
this.rhs = extraInfo.rhs || null;
|
||||
|
||||
/** @property {boolean} Whether this mapping accepts an argument. */
|
||||
this.arg = extraInfo.arg || false;
|
||||
/** @property {boolean} Whether this mapping accepts a count. */
|
||||
this.count = extraInfo.count || false;
|
||||
/**
|
||||
* @property {boolean} Whether the mapping accepts a motion mapping
|
||||
* as an argument.
|
||||
*/
|
||||
this.motion = extraInfo.motion || false;
|
||||
/**
|
||||
* @property {boolean} Whether the mapping's key events should be
|
||||
* propagated to the host application.
|
||||
*/
|
||||
// TODO: I'm not sure this is the best name but it reflects that which it replaced. --djk
|
||||
this.route = extraInfo.route || false;
|
||||
/** @property {boolean} Whether the RHS of the mapping should expand mappings recursively. */
|
||||
this.noremap = extraInfo.noremap || false;
|
||||
/** @property {boolean} Whether any output from the mapping should be echoed on the command line. */
|
||||
this.silent = extraInfo.silent || false;
|
||||
/** @property {string} The literal RHS expansion of this mapping. */
|
||||
this.rhs = extraInfo.rhs || null;
|
||||
}
|
||||
|
||||
Map.prototype = {
|
||||
@@ -98,11 +110,11 @@ Map.prototype = {
|
||||
{
|
||||
let args = [];
|
||||
|
||||
if (this.flags & Mappings.flags.MOTION)
|
||||
if (this.motion)
|
||||
args.push(motion);
|
||||
if (this.flags & Mappings.flags.COUNT)
|
||||
if (this.count)
|
||||
args.push(count);
|
||||
if (this.flags & Mappings.flags.ARGUMENT)
|
||||
if (this.arg)
|
||||
args.push(argument);
|
||||
|
||||
let self = this;
|
||||
@@ -213,7 +225,7 @@ function Mappings() //{{{
|
||||
"User defined mapping",
|
||||
function (count) { events.feedkeys((count > -1 ? count : "") + this.rhs, this.noremap, this.silent); },
|
||||
{
|
||||
flags: Mappings.flags.COUNT,
|
||||
count: true,
|
||||
rhs: events.canonicalKeys(rhs),
|
||||
noremap: !!noremap,
|
||||
silent: "<silent>" in args
|
||||
@@ -334,14 +346,6 @@ function Mappings() //{{{
|
||||
]);
|
||||
});
|
||||
|
||||
// FIXME:
|
||||
Mappings.flags = {
|
||||
ALLOW_EVENT_ROUTING: 1 << 0, // if set, return true inside the map command to pass the event further to Firefox
|
||||
MOTION: 1 << 1,
|
||||
COUNT: 1 << 2,
|
||||
ARGUMENT: 1 << 3
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
// NOTE: just normal mode for now
|
||||
|
||||
@@ -233,17 +233,17 @@ function Tabs() //{{{
|
||||
else
|
||||
tabs.select("+1", true);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["<C-n>", "<C-Tab>", "<C-PageDown>"],
|
||||
"Go to the next tab",
|
||||
function (count) { tabs.select("+" + (count < 1 ? 1 : count), true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["gT", "<C-p>", "<C-S-Tab>", "<C-PageUp>"],
|
||||
"Go to previous tab",
|
||||
function (count) { tabs.select("-" + (count < 1 ? 1 : count), true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
if (config.hasTabbrowser)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ function Tabs() //{{{
|
||||
else
|
||||
commandline.open(":", "buffer! ", modes.EX);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["B"],
|
||||
"Show buffer list",
|
||||
@@ -265,22 +265,22 @@ function Tabs() //{{{
|
||||
mappings.add([modes.NORMAL], ["d"],
|
||||
"Delete current buffer",
|
||||
function (count) { tabs.remove(tabs.getTab(), count, false, 0); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["D"],
|
||||
"Delete current buffer, focus tab to the left",
|
||||
function (count) { tabs.remove(tabs.getTab(), count, true, 0); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["gb"],
|
||||
"Repeat last :buffer[!] command",
|
||||
function (count) { tabs.switchTo(null, null, count, false); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["gB"],
|
||||
"Repeat last :buffer[!] command in reverse direction",
|
||||
function (count) { tabs.switchTo(null, null, count, true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
// TODO: feature dependencies - implies "session"?
|
||||
if (liberator.has("tabUndo"))
|
||||
@@ -288,7 +288,7 @@ function Tabs() //{{{
|
||||
mappings.add([modes.NORMAL], ["u"],
|
||||
"Undo closing of a tab",
|
||||
function (count) { commands.get("undo").execute("", false, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
}
|
||||
|
||||
mappings.add([modes.NORMAL], ["<C-^>", "<C-6>"],
|
||||
@@ -300,7 +300,7 @@ function Tabs() //{{{
|
||||
else
|
||||
tabs.switchTo(count.toString(), false);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
|
||||
@@ -911,7 +911,7 @@ function CommandLine() //{{{
|
||||
commandline.resetCompletions();
|
||||
return editor.expandAbbreviation("c");
|
||||
},
|
||||
{ flags: Mappings.flags.ALLOW_EVENT_ROUTING });
|
||||
{ route: true });
|
||||
|
||||
mappings.add(myModes,
|
||||
["<C-]>", "<C-5>"], "Expand command line abbreviation",
|
||||
|
||||
@@ -273,7 +273,7 @@ function Mail() //{{{
|
||||
mappings.add(myModes, ["<Space>"],
|
||||
"Scroll message or select next unread one",
|
||||
function () true,
|
||||
{ flags: Mappings.flags.ALLOW_EVENT_ROUTING });
|
||||
{ route: true });
|
||||
|
||||
mappings.add(myModes, ["t"],
|
||||
"Select thread",
|
||||
@@ -286,32 +286,32 @@ function Mail() //{{{
|
||||
mappings.add(myModes, ["j", "<Right>"],
|
||||
"Select next message",
|
||||
function (count) { mail.selectMessage(function (msg) true, false, false, false, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["gj"],
|
||||
"Select next message, including closed threads",
|
||||
function (count) { mail.selectMessage(function (msg) true, false, true, false, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["J", "<Tab>"],
|
||||
"Select next unread message",
|
||||
function (count) { mail.selectMessage(function (msg) !msg.isRead, true, true, false, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["k", "<Left>"],
|
||||
"Select previous message",
|
||||
function (count) { mail.selectMessage(function (msg) true, false, false, true, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["gk"],
|
||||
"Select previous message",
|
||||
function (count) { mail.selectMessage(function (msg) true, false, true, true, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["K"],
|
||||
"Select previous unread message",
|
||||
function (count) { mail.selectMessage(function (msg) !msg.isRead, true, true, true, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["*"],
|
||||
"Select next message from the same sender",
|
||||
@@ -324,7 +324,7 @@ function Mail() //{{{
|
||||
}
|
||||
catch (e) { liberator.beep(); }
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["#"],
|
||||
"Select previous message from the same sender",
|
||||
@@ -337,7 +337,7 @@ function Mail() //{{{
|
||||
}
|
||||
catch (e) { liberator.beep(); }
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
// SENDING MESSAGES
|
||||
mappings.add(myModes, ["m"],
|
||||
@@ -379,22 +379,22 @@ function Mail() //{{{
|
||||
mappings.add(myModes, ["<Down>"],
|
||||
"Scroll message down",
|
||||
function (count) { buffer.scrollLines(Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["<Up>"],
|
||||
"Scroll message up",
|
||||
function (count) { buffer.scrollLines(-Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.MESSAGE], ["<Left>"],
|
||||
"Select previous message",
|
||||
function (count) { mail.selectMessage(function (msg) true, false, false, true, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.MESSAGE], ["<Right>"],
|
||||
"Select next message",
|
||||
function (count) { mail.selectMessage(function (msg) true, false, false, false, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
// UNDO/REDO
|
||||
mappings.add(myModes, ["u"],
|
||||
@@ -445,22 +445,22 @@ function Mail() //{{{
|
||||
mappings.add(myModes, ["]s"],
|
||||
"Select next starred message",
|
||||
function (count) { mail.selectMessage(function (msg) msg.isFlagged, true, true, false, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["[s"],
|
||||
"Select previous starred message",
|
||||
function (count) { mail.selectMessage(function (msg) msg.isFlagged, true, true, true, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["]a"],
|
||||
"Select next message with an attachment",
|
||||
function (count) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, false, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["[a"],
|
||||
"Select previous message with an attachment",
|
||||
function (count) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, true, count); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
// FOLDER SWITCHING
|
||||
mappings.add(myModes, ["gi"],
|
||||
@@ -473,7 +473,7 @@ function Mail() //{{{
|
||||
else
|
||||
liberator.beep();
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["<C-n>"],
|
||||
"Select next folder",
|
||||
@@ -488,7 +488,7 @@ function Mail() //{{{
|
||||
}
|
||||
gFolderTreeView.selection.timedSelect(newPos, 500);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["<C-N>"],
|
||||
"Go to next mailbox with unread messages",
|
||||
@@ -496,7 +496,7 @@ function Mail() //{{{
|
||||
{
|
||||
selectUnreadFolder(false, count);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["<C-p>"],
|
||||
"Select previous folder",
|
||||
@@ -511,7 +511,7 @@ function Mail() //{{{
|
||||
}
|
||||
gFolderTreeView.selection.timedSelect(newPos, 500);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["<C-P>"],
|
||||
"Go to previous mailbox with unread messages",
|
||||
@@ -519,7 +519,7 @@ function Mail() //{{{
|
||||
{
|
||||
selectUnreadFolder(true, count);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
// THREADING
|
||||
mappings.add(myModes, ["za"],
|
||||
@@ -545,22 +545,22 @@ function Mail() //{{{
|
||||
mappings.add(myModes, ["<C-i>"],
|
||||
"Go forward",
|
||||
function (count) { if (count < 1) count = 1; while (count--) GoNextMessage(nsMsgNavigationType.forward, true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["<C-o>"],
|
||||
"Go back",
|
||||
function (count) { if (count < 1) count = 1; while (count--) GoNextMessage(nsMsgNavigationType.back, true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["gg"],
|
||||
"Select first message",
|
||||
function (count) { if (count < 1) count = 1; while (count--) GoNextMessage(nsMsgNavigationType.firstMessage, true); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["G"],
|
||||
"Select last message",
|
||||
function (count) { if (count < 1) count = 1; while (count--) GoNextMessage(nsMsgNavigationType.lastMessage, false); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
// tagging messages
|
||||
mappings.add(myModes, ["l"],
|
||||
@@ -583,7 +583,7 @@ function Mail() //{{{
|
||||
}
|
||||
},
|
||||
{
|
||||
flags: Mappings.flags.ARGUMENT
|
||||
arg: true
|
||||
});
|
||||
|
||||
// TODO: change binding?
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
2009-XX-XX:
|
||||
* version 2.2a1pre
|
||||
* IMPORTANT: Map.flags has been replaced with individual properties.
|
||||
Mappings defined in plugins with mappings.add will need to be updated.
|
||||
E.g.
|
||||
mappings.add(...,
|
||||
{ flags: Mappings.flags.ARGUMENT |
|
||||
Mappings.flags.COUNT |
|
||||
Mappings.flags.MOTION |
|
||||
Mappings.flags.ALLOW_EVENT_ROUTING });
|
||||
is now
|
||||
mappings.add(...,
|
||||
{ arg: true, count: true, motion: true, route: true });
|
||||
* IMPORTANT: shifted key notation now matches Vim's behaviour. E.g. <C-a>
|
||||
and <C-A> are equivalent, to map the uppercase character use <C-S-A>.
|
||||
and <C-A> are equivalent, to map the uppercase character use <C-S-A>. - Is this still true, or going to be true? --djk
|
||||
* add -description option to :command
|
||||
* command-line options are now supported via the host application's
|
||||
-liberator option
|
||||
|
||||
@@ -233,12 +233,12 @@ const config = { //{{{
|
||||
mappings.add([modes.NORMAL],
|
||||
["<C-a>"], "Increment last number in URL",
|
||||
function (count) { incrementURL(Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL],
|
||||
["<C-x>"], "Decrement last number in URL",
|
||||
function (count) { incrementURL(-Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["~"],
|
||||
"Open home directory",
|
||||
@@ -294,7 +294,7 @@ const config = { //{{{
|
||||
else
|
||||
liberator.open(url);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["gU"],
|
||||
"Go to the root of the website",
|
||||
|
||||
@@ -335,12 +335,12 @@ const config = { //{{{
|
||||
mappings.add([modes.NORMAL],
|
||||
["<C-a>"], "Increment last number in URL",
|
||||
function (count) { incrementURL(Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL],
|
||||
["<C-x>"], "Decrement last number in URL",
|
||||
function (count) { incrementURL(-Math.max(count, 1)); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["~"],
|
||||
"Open home directory",
|
||||
@@ -396,7 +396,7 @@ const config = { //{{{
|
||||
else
|
||||
liberator.open(url);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.NORMAL], ["gU"],
|
||||
"Go to the root of the website",
|
||||
|
||||
@@ -150,22 +150,22 @@ function Player() // {{{
|
||||
mappings.add([modes.PLAYER],
|
||||
["h", "<Left>"], "Seek -10s",
|
||||
function (count) { player.seekBackward(Math.max(1, count) * 10000); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.PLAYER],
|
||||
["l", "<Right>"], "Seek +10s",
|
||||
function (count) { player.seekForward(Math.max(1, count) * 10000); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.PLAYER],
|
||||
["H", "<S-Left>"], "Seek -1m",
|
||||
function (count) { player.seekBackward(Math.max(1, count) * 60000); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.PLAYER],
|
||||
["L", "<S-Right>"], "Seek +1m",
|
||||
function (count) { player.seekForward(Math.max(1, count) * 60000); },
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.PLAYER],
|
||||
["=", "+"], "Increase volume by 10%",
|
||||
|
||||
Reference in New Issue
Block a user