mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 23:58:00 +01:00
began moving some mappings from mappings.js -> buffer.js; Also the constructors of Mail() and Buffer() accept an argument in which mode they should add the mapping
This commit is contained in:
@@ -26,11 +26,12 @@ the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
}}} ***** END LICENSE BLOCK *****/
|
||||
|
||||
vimperator.Buffer = function () //{{{
|
||||
vimperator.Buffer = function (browserModes) //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
var modes = browserModes || [vimperator.modes.NORMAL];
|
||||
|
||||
var zoomLevels = [ 1, 10, 25, 50, 75, 90, 100,
|
||||
120, 150, 200, 300, 500, 1000, 2000 ];
|
||||
@@ -139,19 +140,6 @@ vimperator.Buffer = function () //{{{
|
||||
win.scrollTo(h, v);
|
||||
}
|
||||
|
||||
vimperator.commands.addUserCommand(new vimperator.Command(["test"],
|
||||
function (args, special)
|
||||
{
|
||||
alert(args)
|
||||
},
|
||||
{
|
||||
shortHelp: "Test command"
|
||||
}
|
||||
));
|
||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["w"], "Test",
|
||||
function () { alert("test"); }
|
||||
);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// OPTIONS /////////////////////////////////////////////////
|
||||
@@ -194,6 +182,42 @@ vimperator.Buffer = function () //{{{
|
||||
getter: function () { return getMarkupDocumentViewer().authorStyleDisabled; },
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
vimperator.mappings.add(modes, ["i", "<Insert>"],
|
||||
"Start caret mode",
|
||||
function ()
|
||||
{
|
||||
// setting this option triggers an observer which takes care of the mode setting
|
||||
vimperator.options.setPref("accessibility.browsewithcaret", true);
|
||||
});
|
||||
|
||||
vimperator.mappings.add(modes, ["j", "<Down>", "<C-e>"],
|
||||
"Scroll document down",
|
||||
function (count) { vimperator.buffer.scrollLines(count > 1 ? count : 1); },
|
||||
{ flags: vimperator.Mappings.flags.COUNT });
|
||||
|
||||
vimperator.mappings.add(modes, ["k", "<Up>", "<C-y>"],
|
||||
"Scroll document up",
|
||||
function (count) { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); },
|
||||
{ flags: vimperator.Mappings.flags.COUNT });
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
vimperator.commands.addUserCommand(new vimperator.Command(["test"],
|
||||
function (args, special)
|
||||
{
|
||||
alert(args)
|
||||
},
|
||||
{
|
||||
shortHelp: "Test command"
|
||||
}
|
||||
));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
@@ -26,12 +26,12 @@ the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
}}} ***** END LICENSE BLOCK *****/
|
||||
|
||||
vimperator.Mail = function ()
|
||||
vimperator.Mail = function (validModes)
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
var modes = validModes || [vimperator.modes.NORMAL];
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// OPTIONS /////////////////////////////////////////////////
|
||||
@@ -48,20 +48,33 @@ vimperator.Mail = function ()
|
||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["<Return>", "<Space>"],
|
||||
vimperator.mappings.add(modes, ["<Return>", "i"],
|
||||
"Focus message",
|
||||
function () { content.focus(); }
|
||||
);
|
||||
function () { content.focus(); });
|
||||
|
||||
// FIXME:the following mappings do not yet work!
|
||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["r"],
|
||||
"Reply to sender",
|
||||
function () { goDoCommand("cmd_reply"); }
|
||||
);
|
||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["d", "<Del>"],
|
||||
vimperator.mappings.add(modes, ["d", "<Del>"],
|
||||
"Move mail to Trash folder",
|
||||
function () { goDoCommand("cmd_delete"); }
|
||||
);
|
||||
function () { goDoCommand("cmd_delete"); });
|
||||
|
||||
vimperator.mappings.add(modes, ["j", "<Right>"],
|
||||
"Select next message",
|
||||
function () { goDoCommand("cmd_nextMsg"); });
|
||||
|
||||
vimperator.mappings.add(modes, ["J", "<Tab>"],
|
||||
"Select next unread message",
|
||||
function () { goDoCommand("cmd_nextUnreadMsg"); });
|
||||
|
||||
vimperator.mappings.add(modes, ["k", "<Left>"],
|
||||
"Select previous message",
|
||||
function () { goDoCommand("cmd_previousMsg"); });
|
||||
|
||||
vimperator.mappings.add(modes, ["K"],
|
||||
"Select previous unread message",
|
||||
function () { goDoCommand("cmd_previousUnreadMsg"); });
|
||||
|
||||
vimperator.mappings.add(modes, ["r"],
|
||||
"Reply to sender",
|
||||
function () { goDoCommand("cmd_reply"); });
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
|
||||
@@ -379,15 +379,6 @@ vimperator.Mappings = function () //{{{
|
||||
{ shortHelp: "Rewind keyboard focus" }
|
||||
));
|
||||
|
||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["i", "<Insert>"],
|
||||
function ()
|
||||
{
|
||||
// setting this option triggers an observer
|
||||
// which takes care of the mode setting
|
||||
vimperator.options.setPref("accessibility.browsewithcaret", true);
|
||||
},
|
||||
{ shortHelp: "Start caret mode" }
|
||||
));
|
||||
addDefaultMap(new vimperator.Map(vimperator.modes.all, ["<C-q>"],
|
||||
function () { vimperator.modes.passAllKeys = true; },
|
||||
{ shortHelp: "Temporarily quit Vimperator mode" }
|
||||
@@ -762,20 +753,6 @@ vimperator.Mappings = function () //{{{
|
||||
flags: vimperator.Mappings.flags.COUNT
|
||||
}
|
||||
));
|
||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["j", "<Down>", "<C-e>"],
|
||||
function (count) { vimperator.buffer.scrollLines(count > 1 ? count : 1); },
|
||||
{
|
||||
shortHelp: "Scroll document down",
|
||||
flags: vimperator.Mappings.flags.COUNT
|
||||
}
|
||||
));
|
||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["k", "<Up>", "<C-y>"],
|
||||
function (count) { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); },
|
||||
{
|
||||
shortHelp: "Scroll document up",
|
||||
flags: vimperator.Mappings.flags.COUNT
|
||||
}
|
||||
));
|
||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["<C-d>"],
|
||||
function (count) { vimperator.buffer.scrollByScrollSize(count, 1); },
|
||||
{
|
||||
|
||||
@@ -29,9 +29,10 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
vimperator.config = {
|
||||
/*** required options, no checks done if they really exist, so be careful ***/
|
||||
name: "Muttator",
|
||||
hostApplication: "Thunderbird",
|
||||
hostApplication: "Thunderbird", // TODO: can this be found out otherwise?
|
||||
|
||||
/*** optional options, there are checked for existance and a fallback provided ***/
|
||||
get browserModes() { return [vimperator.modes.MESSAGE]; },
|
||||
features: ["mail", "hints"],
|
||||
get mainWidget() { return GetThreadTree(); }, // focusContent() focuses this widget
|
||||
mainWindowID: "messengerWindow", // used for :set titlestring
|
||||
|
||||
@@ -496,13 +496,13 @@ const vimperator = (function () //{{{
|
||||
vimperator.log("Loading module statusline...", 3);
|
||||
vimperator.statusline = vimperator.StatusLine();
|
||||
vimperator.log("Loading module buffer...", 3);
|
||||
vimperator.buffer = vimperator.Buffer();
|
||||
vimperator.buffer = vimperator.Buffer(vimperator.config.browserModes || [vimperator.modes.NORMAL]);
|
||||
vimperator.log("Loading module editor...", 3);
|
||||
vimperator.editor = vimperator.Editor();
|
||||
if (vimperator.has("mail"))
|
||||
{
|
||||
vimperator.log("Loading module mail...", 3);
|
||||
vimperator.mail = vimperator.Mail();
|
||||
vimperator.mail = vimperator.Mail(vimperator.config.mailModes || [vimperator.modes.NORMAL]);
|
||||
}
|
||||
if (vimperator.has("tabs"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user