mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 23:58:00 +01:00
all mappings apart from various insert modes are finally there where they should be
This commit is contained in:
@@ -105,6 +105,26 @@ vimperator.Bookmarks = function () //{{{
|
|||||||
"Speed up first time history/bookmark completion",
|
"Speed up first time history/bookmark completion",
|
||||||
"boolean", true);
|
"boolean", true);
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
var modes = vimperator.config.browserModes || [vimperator.modes.NORMAL];
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes, ["a"],
|
||||||
|
"Open a prompt to bookmark the current URL",
|
||||||
|
function ()
|
||||||
|
{
|
||||||
|
var title = "";
|
||||||
|
if (vimperator.buffer.title != vimperator.buffer.URL)
|
||||||
|
title = " -title=\"" + vimperator.buffer.title + "\"";
|
||||||
|
vimperator.commandline.open(":", "bmark " + vimperator.buffer.URL + title, vimperator.modes.EX);
|
||||||
|
});
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes, ["A"],
|
||||||
|
"Toggle bookmarked state of current URL",
|
||||||
|
function () { vimperator.bookmarks.toggle(vimperator.buffer.URL); });
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
@@ -437,6 +457,31 @@ vimperator.History = function () //{{{
|
|||||||
rootNode.containerOpen = false;
|
rootNode.containerOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
var modes = vimperator.config.browserModes || [vimperator.modes.NORMAL];
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["<C-o>"], "Go to an older position in the jump list",
|
||||||
|
function (count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); },
|
||||||
|
{ flags: vimperator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["<C-i>"], "Go to a newer position in the jump list",
|
||||||
|
function (count) { vimperator.history.stepTo(count > 1 ? count : 1); },
|
||||||
|
{ flags: vimperator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["H", "<A-Left>", "<M-Left>"], "Go back in the browser history",
|
||||||
|
function (count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); },
|
||||||
|
{ flags: vimperator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["L", "<A-Right>", "<M-Right>"], "Go forward in the browser history",
|
||||||
|
function (count) { vimperator.history.stepTo(count > 1 ? count : 1); },
|
||||||
|
{ flags: vimperator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
@@ -556,265 +601,6 @@ vimperator.History = function () //{{{
|
|||||||
//}}}
|
//}}}
|
||||||
}; //}}}
|
}; //}}}
|
||||||
|
|
||||||
vimperator.Marks = function () //{{{
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
|
||||||
|
|
||||||
var localMarks = {};
|
|
||||||
var urlMarks = {};
|
|
||||||
var pendingJumps = [];
|
|
||||||
var appContent = document.getElementById("appcontent");
|
|
||||||
|
|
||||||
if (appContent)
|
|
||||||
appContent.addEventListener("load", onPageLoad, true);
|
|
||||||
|
|
||||||
function onPageLoad(event)
|
|
||||||
{
|
|
||||||
var win = event.originalTarget.defaultView;
|
|
||||||
for (var i = 0, length = pendingJumps.length; i < length; i++)
|
|
||||||
{
|
|
||||||
var mark = pendingJumps[i];
|
|
||||||
if (win.location.href == mark.location)
|
|
||||||
{
|
|
||||||
win.scrollTo(mark.position.x * win.scrollMaxX, mark.position.y * win.scrollMaxY);
|
|
||||||
pendingJumps.splice(i, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeLocalMark(mark)
|
|
||||||
{
|
|
||||||
if (mark in localMarks)
|
|
||||||
{
|
|
||||||
var win = window.content;
|
|
||||||
for (var i = 0; i < localMarks[mark].length; i++)
|
|
||||||
{
|
|
||||||
if (localMarks[mark][i].location == win.location.href)
|
|
||||||
{
|
|
||||||
vimperator.log("Deleting local mark: " + mark + " | " + localMarks[mark][i].location + " | (" + localMarks[mark][i].position.x + ", " + localMarks[mark][i].position.y + ") | tab: " + vimperator.tabs.index(localMarks[mark][i].tab), 5);
|
|
||||||
localMarks[mark].splice(i, 1);
|
|
||||||
if (localMarks[mark].length == 0)
|
|
||||||
delete localMarks[mark];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeURLMark(mark)
|
|
||||||
{
|
|
||||||
if (mark in urlMarks)
|
|
||||||
{
|
|
||||||
vimperator.log("Deleting URL mark: " + mark + " | " + urlMarks[mark].location + " | (" + urlMarks[mark].position.x + ", " + urlMarks[mark].position.y + ") | tab: " + vimperator.tabs.index(urlMarks[mark].tab), 5);
|
|
||||||
delete urlMarks[mark];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isLocalMark(mark)
|
|
||||||
{
|
|
||||||
return /^[a-z]$/.test(mark);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isURLMark(mark)
|
|
||||||
{
|
|
||||||
return /^[A-Z0-9]$/.test(mark);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSortedMarks()
|
|
||||||
{
|
|
||||||
// local marks
|
|
||||||
var lmarks = [];
|
|
||||||
|
|
||||||
for (var mark in localMarks)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < localMarks[mark].length; i++)
|
|
||||||
{
|
|
||||||
if (localMarks[mark][i].location == window.content.location.href)
|
|
||||||
lmarks.push([mark, localMarks[mark][i]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lmarks.sort();
|
|
||||||
|
|
||||||
// URL marks
|
|
||||||
var umarks = [];
|
|
||||||
|
|
||||||
for (var mark in urlMarks)
|
|
||||||
umarks.push([mark, urlMarks[mark]]);
|
|
||||||
// FIXME: why does umarks.sort() cause a "Component is not available =
|
|
||||||
// NS_ERROR_NOT_AVAILABLE" exception when used here?
|
|
||||||
umarks.sort(function (a, b) {
|
|
||||||
if (a[0] < b[0])
|
|
||||||
return -1;
|
|
||||||
else if (a[0] > b[0])
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
return lmarks.concat(umarks);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
|
||||||
|
|
||||||
return {
|
|
||||||
|
|
||||||
// TODO: add support for frameset pages
|
|
||||||
add: function (mark)
|
|
||||||
{
|
|
||||||
var win = window.content;
|
|
||||||
|
|
||||||
if (win.document.body.localName.toLowerCase() == "frameset")
|
|
||||||
{
|
|
||||||
vimperator.echoerr("marks support for frameset pages not implemented yet");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var x = win.scrollMaxX ? win.pageXOffset / win.scrollMaxX : 0;
|
|
||||||
var y = win.scrollMaxY ? win.pageYOffset / win.scrollMaxY : 0;
|
|
||||||
var position = { x: x, y: y };
|
|
||||||
|
|
||||||
if (isURLMark(mark))
|
|
||||||
{
|
|
||||||
vimperator.log("Adding URL mark: " + mark + " | " + win.location.href + " | (" + position.x + ", " + position.y + ") | tab: " + vimperator.tabs.index(vimperator.tabs.getTab()), 5);
|
|
||||||
urlMarks[mark] = { location: win.location.href, position: position, tab: vimperator.tabs.getTab() };
|
|
||||||
}
|
|
||||||
else if (isLocalMark(mark))
|
|
||||||
{
|
|
||||||
// remove any previous mark of the same name for this location
|
|
||||||
removeLocalMark(mark);
|
|
||||||
if (!localMarks[mark])
|
|
||||||
localMarks[mark] = [];
|
|
||||||
vimperator.log("Adding local mark: " + mark + " | " + win.location.href + " | (" + position.x + ", " + position.y + ")", 5);
|
|
||||||
localMarks[mark].push({ location: win.location.href, position: position });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
remove: function (filter, special)
|
|
||||||
{
|
|
||||||
if (special)
|
|
||||||
{
|
|
||||||
// :delmarks! only deletes a-z marks
|
|
||||||
for (var mark in localMarks)
|
|
||||||
removeLocalMark(mark);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var pattern = new RegExp("[" + filter.replace(/\s+/g, "") + "]");
|
|
||||||
for (var mark in urlMarks)
|
|
||||||
{
|
|
||||||
if (pattern.test(mark))
|
|
||||||
removeURLMark(mark);
|
|
||||||
}
|
|
||||||
for (var mark in localMarks)
|
|
||||||
{
|
|
||||||
if (pattern.test(mark))
|
|
||||||
removeLocalMark(mark);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
jumpTo: function (mark)
|
|
||||||
{
|
|
||||||
var ok = false;
|
|
||||||
|
|
||||||
if (isURLMark(mark))
|
|
||||||
{
|
|
||||||
var slice = urlMarks[mark];
|
|
||||||
if (slice && slice.tab && slice.tab.linkedBrowser)
|
|
||||||
{
|
|
||||||
if (!slice.tab.parentNode)
|
|
||||||
{
|
|
||||||
pendingJumps.push(slice);
|
|
||||||
// NOTE: this obviously won't work on generated pages using
|
|
||||||
// non-unique URLs, like Vimperator's help :(
|
|
||||||
vimperator.open(slice.location, vimperator.NEW_TAB);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var index = vimperator.tabs.index(slice.tab);
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
vimperator.tabs.select(index);
|
|
||||||
var win = slice.tab.linkedBrowser.contentWindow;
|
|
||||||
if (win.location.href != slice.location)
|
|
||||||
{
|
|
||||||
pendingJumps.push(slice);
|
|
||||||
win.location.href = slice.location;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
vimperator.log("Jumping to URL mark: " + mark + " | " + slice.location + " | (" + slice.position.x + ", " + slice.position.y + ") | tab: " + vimperator.tabs.index(slice.tab), 5);
|
|
||||||
win.scrollTo(slice.position.x * win.scrollMaxX, slice.position.y * win.scrollMaxY);
|
|
||||||
ok = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isLocalMark(mark))
|
|
||||||
{
|
|
||||||
var win = window.content;
|
|
||||||
var slice = localMarks[mark] || [];
|
|
||||||
|
|
||||||
for (var i = 0; i < slice.length; i++)
|
|
||||||
{
|
|
||||||
if (win.location.href == slice[i].location)
|
|
||||||
{
|
|
||||||
vimperator.log("Jumping to local mark: " + mark + " | " + slice[i].location + " | (" + slice[i].position.x + ", " + slice[i].position.y + ")", 5);
|
|
||||||
win.scrollTo(slice[i].position.x * win.scrollMaxX, slice[i].position.y * win.scrollMaxY);
|
|
||||||
ok = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ok)
|
|
||||||
vimperator.echoerr("E20: Mark not set"); // FIXME: move up?
|
|
||||||
},
|
|
||||||
|
|
||||||
list: function (filter)
|
|
||||||
{
|
|
||||||
var marks = getSortedMarks();
|
|
||||||
|
|
||||||
if (marks.length == 0)
|
|
||||||
{
|
|
||||||
vimperator.echoerr("No marks set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.length > 0)
|
|
||||||
{
|
|
||||||
marks = marks.filter(function (mark) {
|
|
||||||
if (filter.indexOf(mark[0]) > -1)
|
|
||||||
return mark;
|
|
||||||
});
|
|
||||||
if (marks.length == 0)
|
|
||||||
{
|
|
||||||
vimperator.echoerr("E283: No marks matching \"" + filter + "\"");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" +
|
|
||||||
"<table><tr align=\"left\" class=\"hl-Title\"><th>mark</th><th>line</th><th>col</th><th>file</th></tr>";
|
|
||||||
for (var i = 0; i < marks.length; i++)
|
|
||||||
{
|
|
||||||
list += "<tr>" +
|
|
||||||
"<td> " + marks[i][0] + "</td>" +
|
|
||||||
"<td align=\"right\">" + Math.round(marks[i][1].position.y * 100) + "%</td>" +
|
|
||||||
"<td align=\"right\">" + Math.round(marks[i][1].position.x * 100) + "%</td>" +
|
|
||||||
"<td style=\"color: green;\">" + vimperator.util.escapeHTML(marks[i][1].location) + "</td>" +
|
|
||||||
"</tr>";
|
|
||||||
}
|
|
||||||
list += "</table>";
|
|
||||||
|
|
||||||
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
//}}}
|
|
||||||
}; //}}}
|
|
||||||
|
|
||||||
vimperator.QuickMarks = function () //{{{
|
vimperator.QuickMarks = function () //{{{
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -831,6 +617,40 @@ vimperator.QuickMarks = function () //{{{
|
|||||||
qmarks[savedMarks[i]] = savedMarks[i + 1];
|
qmarks[savedMarks[i]] = savedMarks[i + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
var modes = vimperator.config.browserModes || [vimperator.modes.NORMAL];
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["go"], "Jump to a QuickMark",
|
||||||
|
function (arg) { vimperator.quickmarks.jumpTo(arg, vimperator.CURRENT_TAB); },
|
||||||
|
{ flags: vimperator.Mappings.flags.ARGUMENT });
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["gn"], "Jump to a QuickMark in a new tab",
|
||||||
|
function (arg)
|
||||||
|
{
|
||||||
|
vimperator.quickmarks.jumpTo(arg,
|
||||||
|
/\bquickmark\b/.test(vimperator.options["activate"]) ?
|
||||||
|
vimperator.NEW_TAB : vimperator.NEW_BACKGROUND_TAB);
|
||||||
|
},
|
||||||
|
{ flags: vimperator.Mappings.flags.ARGUMENT });
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["M"], "Add new QuickMark for current URL",
|
||||||
|
function (arg)
|
||||||
|
{
|
||||||
|
if (/[^a-zA-Z0-9]/.test(arg))
|
||||||
|
{
|
||||||
|
vimperator.beep();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vimperator.quickmarks.add(arg, vimperator.buffer.URL);
|
||||||
|
},
|
||||||
|
{ flags: vimperator.Mappings.flags.ARGUMENT });
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|||||||
@@ -26,12 +26,11 @@ 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.
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
vimperator.Buffer = function (browserModes) //{{{
|
vimperator.Buffer = function () //{{{
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
var modes = browserModes || [vimperator.modes.NORMAL];
|
|
||||||
|
|
||||||
var zoomLevels = [ 1, 10, 25, 50, 75, 90, 100,
|
var zoomLevels = [ 1, 10, 25, 50, 75, 90, 100,
|
||||||
120, 150, 200, 300, 500, 1000, 2000 ];
|
120, 150, 200, 300, 500, 1000, 2000 ];
|
||||||
@@ -185,6 +184,7 @@ vimperator.Buffer = function (browserModes) //{{{
|
|||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
var modes = vimperator.config.browserModes || [vimperator.modes.NORMAL];
|
||||||
|
|
||||||
vimperator.mappings.add(modes, ["i", "<Insert>"],
|
vimperator.mappings.add(modes, ["i", "<Insert>"],
|
||||||
"Start caret mode",
|
"Start caret mode",
|
||||||
@@ -312,11 +312,6 @@ vimperator.Buffer = function (browserModes) //{{{
|
|||||||
vimperator.NEW_BACKGROUND_TAB : vimperator.NEW_TAB);
|
vimperator.NEW_BACKGROUND_TAB : vimperator.NEW_TAB);
|
||||||
});
|
});
|
||||||
|
|
||||||
vimperator.mappings.add(modes, ["'", "`"],
|
|
||||||
"Jump to the mark in the current buffer",
|
|
||||||
function (arg) { vimperator.marks.jumpTo(arg); },
|
|
||||||
{ flags: vimperator.Mappings.flags.ARGUMENT });
|
|
||||||
|
|
||||||
vimperator.mappings.add(modes, ["p", "<MiddleMouse>"],
|
vimperator.mappings.add(modes, ["p", "<MiddleMouse>"],
|
||||||
"Open (put) a URL based on the current clipboard contents in the current buffer",
|
"Open (put) a URL based on the current clipboard contents in the current buffer",
|
||||||
function () { vimperator.open(readFromClipboard()); });
|
function () { vimperator.open(readFromClipboard()); });
|
||||||
@@ -330,7 +325,7 @@ vimperator.Buffer = function (browserModes) //{{{
|
|||||||
vimperator.NEW_TAB : vimperator.NEW_BACKGROUND_TAB);
|
vimperator.NEW_TAB : vimperator.NEW_BACKGROUND_TAB);
|
||||||
});
|
});
|
||||||
|
|
||||||
// reload
|
// reloading
|
||||||
vimperator.mappings.add(modes, ["r"],
|
vimperator.mappings.add(modes, ["r"],
|
||||||
"Reload current page",
|
"Reload current page",
|
||||||
function () { vimperator.tabs.reload(getBrowser().mCurrentTab, false); });
|
function () { vimperator.tabs.reload(getBrowser().mCurrentTab, false); });
|
||||||
@@ -339,7 +334,19 @@ vimperator.Buffer = function (browserModes) //{{{
|
|||||||
"Reload while skipping the cache",
|
"Reload while skipping the cache",
|
||||||
function () { vimperator.tabs.reload(getBrowser().mCurrentTab, true); });
|
function () { vimperator.tabs.reload(getBrowser().mCurrentTab, true); });
|
||||||
|
|
||||||
// zoom
|
// yanking
|
||||||
|
vimperator.options.add(modes, ["Y"],
|
||||||
|
"Copy selected text",
|
||||||
|
function ()
|
||||||
|
{
|
||||||
|
var sel = window.content.document.getSelection();
|
||||||
|
if (sel)
|
||||||
|
vimperator.copyToClipboard(sel, true);
|
||||||
|
else
|
||||||
|
vimperator.beep();
|
||||||
|
});
|
||||||
|
|
||||||
|
// zooming
|
||||||
vimperator.mappings.add(modes, ["zi", "+"],
|
vimperator.mappings.add(modes, ["zi", "+"],
|
||||||
"Enlarge text zoom of current web page",
|
"Enlarge text zoom of current web page",
|
||||||
function (count) { vimperator.buffer.zoomIn(count > 1 ? count : 1, false); },
|
function (count) { vimperator.buffer.zoomIn(count > 1 ? count : 1, false); },
|
||||||
@@ -1225,4 +1232,291 @@ vimperator.Buffer = function (browserModes) //{{{
|
|||||||
//}}}
|
//}}}
|
||||||
}; //}}}
|
}; //}}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vimperator.Marks = function () //{{{
|
||||||
|
{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
|
var localMarks = {};
|
||||||
|
var urlMarks = {};
|
||||||
|
var pendingJumps = [];
|
||||||
|
var appContent = document.getElementById("appcontent");
|
||||||
|
|
||||||
|
if (appContent)
|
||||||
|
appContent.addEventListener("load", onPageLoad, true);
|
||||||
|
|
||||||
|
function onPageLoad(event)
|
||||||
|
{
|
||||||
|
var win = event.originalTarget.defaultView;
|
||||||
|
for (var i = 0, length = pendingJumps.length; i < length; i++)
|
||||||
|
{
|
||||||
|
var mark = pendingJumps[i];
|
||||||
|
if (win.location.href == mark.location)
|
||||||
|
{
|
||||||
|
win.scrollTo(mark.position.x * win.scrollMaxX, mark.position.y * win.scrollMaxY);
|
||||||
|
pendingJumps.splice(i, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeLocalMark(mark)
|
||||||
|
{
|
||||||
|
if (mark in localMarks)
|
||||||
|
{
|
||||||
|
var win = window.content;
|
||||||
|
for (var i = 0; i < localMarks[mark].length; i++)
|
||||||
|
{
|
||||||
|
if (localMarks[mark][i].location == win.location.href)
|
||||||
|
{
|
||||||
|
vimperator.log("Deleting local mark: " + mark + " | " + localMarks[mark][i].location + " | (" + localMarks[mark][i].position.x + ", " + localMarks[mark][i].position.y + ") | tab: " + vimperator.tabs.index(localMarks[mark][i].tab), 5);
|
||||||
|
localMarks[mark].splice(i, 1);
|
||||||
|
if (localMarks[mark].length == 0)
|
||||||
|
delete localMarks[mark];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeURLMark(mark)
|
||||||
|
{
|
||||||
|
if (mark in urlMarks)
|
||||||
|
{
|
||||||
|
vimperator.log("Deleting URL mark: " + mark + " | " + urlMarks[mark].location + " | (" + urlMarks[mark].position.x + ", " + urlMarks[mark].position.y + ") | tab: " + vimperator.tabs.index(urlMarks[mark].tab), 5);
|
||||||
|
delete urlMarks[mark];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLocalMark(mark)
|
||||||
|
{
|
||||||
|
return /^[a-z]$/.test(mark);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isURLMark(mark)
|
||||||
|
{
|
||||||
|
return /^[A-Z0-9]$/.test(mark);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSortedMarks()
|
||||||
|
{
|
||||||
|
// local marks
|
||||||
|
var lmarks = [];
|
||||||
|
|
||||||
|
for (var mark in localMarks)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < localMarks[mark].length; i++)
|
||||||
|
{
|
||||||
|
if (localMarks[mark][i].location == window.content.location.href)
|
||||||
|
lmarks.push([mark, localMarks[mark][i]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lmarks.sort();
|
||||||
|
|
||||||
|
// URL marks
|
||||||
|
var umarks = [];
|
||||||
|
|
||||||
|
for (var mark in urlMarks)
|
||||||
|
umarks.push([mark, urlMarks[mark]]);
|
||||||
|
// FIXME: why does umarks.sort() cause a "Component is not available =
|
||||||
|
// NS_ERROR_NOT_AVAILABLE" exception when used here?
|
||||||
|
umarks.sort(function (a, b) {
|
||||||
|
if (a[0] < b[0])
|
||||||
|
return -1;
|
||||||
|
else if (a[0] > b[0])
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
return lmarks.concat(umarks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
var modes = vimperator.config.browserModes || [vimperator.modes.NORMAL];
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["m"], "Set mark at the cursor position",
|
||||||
|
function (arg)
|
||||||
|
{
|
||||||
|
if (/[^a-zA-Z]/.test(arg))
|
||||||
|
{
|
||||||
|
vimperator.beep();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vimperator.marks.add(arg);
|
||||||
|
},
|
||||||
|
{ flags: vimperator.Mappings.flags.ARGUMENT });
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["'", "`"], "Jump to the mark in the current buffer",
|
||||||
|
function (arg) { vimperator.marks.jumpTo(arg); },
|
||||||
|
{ flags: vimperator.Mappings.flags.ARGUMENT });
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
// TODO: add support for frameset pages
|
||||||
|
add: function (mark)
|
||||||
|
{
|
||||||
|
var win = window.content;
|
||||||
|
|
||||||
|
if (win.document.body.localName.toLowerCase() == "frameset")
|
||||||
|
{
|
||||||
|
vimperator.echoerr("marks support for frameset pages not implemented yet");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var x = win.scrollMaxX ? win.pageXOffset / win.scrollMaxX : 0;
|
||||||
|
var y = win.scrollMaxY ? win.pageYOffset / win.scrollMaxY : 0;
|
||||||
|
var position = { x: x, y: y };
|
||||||
|
|
||||||
|
if (isURLMark(mark))
|
||||||
|
{
|
||||||
|
vimperator.log("Adding URL mark: " + mark + " | " + win.location.href + " | (" + position.x + ", " + position.y + ") | tab: " + vimperator.tabs.index(vimperator.tabs.getTab()), 5);
|
||||||
|
urlMarks[mark] = { location: win.location.href, position: position, tab: vimperator.tabs.getTab() };
|
||||||
|
}
|
||||||
|
else if (isLocalMark(mark))
|
||||||
|
{
|
||||||
|
// remove any previous mark of the same name for this location
|
||||||
|
removeLocalMark(mark);
|
||||||
|
if (!localMarks[mark])
|
||||||
|
localMarks[mark] = [];
|
||||||
|
vimperator.log("Adding local mark: " + mark + " | " + win.location.href + " | (" + position.x + ", " + position.y + ")", 5);
|
||||||
|
localMarks[mark].push({ location: win.location.href, position: position });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
remove: function (filter, special)
|
||||||
|
{
|
||||||
|
if (special)
|
||||||
|
{
|
||||||
|
// :delmarks! only deletes a-z marks
|
||||||
|
for (var mark in localMarks)
|
||||||
|
removeLocalMark(mark);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var pattern = new RegExp("[" + filter.replace(/\s+/g, "") + "]");
|
||||||
|
for (var mark in urlMarks)
|
||||||
|
{
|
||||||
|
if (pattern.test(mark))
|
||||||
|
removeURLMark(mark);
|
||||||
|
}
|
||||||
|
for (var mark in localMarks)
|
||||||
|
{
|
||||||
|
if (pattern.test(mark))
|
||||||
|
removeLocalMark(mark);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
jumpTo: function (mark)
|
||||||
|
{
|
||||||
|
var ok = false;
|
||||||
|
|
||||||
|
if (isURLMark(mark))
|
||||||
|
{
|
||||||
|
var slice = urlMarks[mark];
|
||||||
|
if (slice && slice.tab && slice.tab.linkedBrowser)
|
||||||
|
{
|
||||||
|
if (!slice.tab.parentNode)
|
||||||
|
{
|
||||||
|
pendingJumps.push(slice);
|
||||||
|
// NOTE: this obviously won't work on generated pages using
|
||||||
|
// non-unique URLs, like Vimperator's help :(
|
||||||
|
vimperator.open(slice.location, vimperator.NEW_TAB);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var index = vimperator.tabs.index(slice.tab);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
vimperator.tabs.select(index);
|
||||||
|
var win = slice.tab.linkedBrowser.contentWindow;
|
||||||
|
if (win.location.href != slice.location)
|
||||||
|
{
|
||||||
|
pendingJumps.push(slice);
|
||||||
|
win.location.href = slice.location;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vimperator.log("Jumping to URL mark: " + mark + " | " + slice.location + " | (" + slice.position.x + ", " + slice.position.y + ") | tab: " + vimperator.tabs.index(slice.tab), 5);
|
||||||
|
win.scrollTo(slice.position.x * win.scrollMaxX, slice.position.y * win.scrollMaxY);
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isLocalMark(mark))
|
||||||
|
{
|
||||||
|
var win = window.content;
|
||||||
|
var slice = localMarks[mark] || [];
|
||||||
|
|
||||||
|
for (var i = 0; i < slice.length; i++)
|
||||||
|
{
|
||||||
|
if (win.location.href == slice[i].location)
|
||||||
|
{
|
||||||
|
vimperator.log("Jumping to local mark: " + mark + " | " + slice[i].location + " | (" + slice[i].position.x + ", " + slice[i].position.y + ")", 5);
|
||||||
|
win.scrollTo(slice[i].position.x * win.scrollMaxX, slice[i].position.y * win.scrollMaxY);
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
vimperator.echoerr("E20: Mark not set"); // FIXME: move up?
|
||||||
|
},
|
||||||
|
|
||||||
|
list: function (filter)
|
||||||
|
{
|
||||||
|
var marks = getSortedMarks();
|
||||||
|
|
||||||
|
if (marks.length == 0)
|
||||||
|
{
|
||||||
|
vimperator.echoerr("No marks set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.length > 0)
|
||||||
|
{
|
||||||
|
marks = marks.filter(function (mark) {
|
||||||
|
if (filter.indexOf(mark[0]) > -1)
|
||||||
|
return mark;
|
||||||
|
});
|
||||||
|
if (marks.length == 0)
|
||||||
|
{
|
||||||
|
vimperator.echoerr("E283: No marks matching \"" + filter + "\"");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" +
|
||||||
|
"<table><tr align=\"left\" class=\"hl-Title\"><th>mark</th><th>line</th><th>col</th><th>file</th></tr>";
|
||||||
|
for (var i = 0; i < marks.length; i++)
|
||||||
|
{
|
||||||
|
list += "<tr>" +
|
||||||
|
"<td> " + marks[i][0] + "</td>" +
|
||||||
|
"<td align=\"right\">" + Math.round(marks[i][1].position.y * 100) + "%</td>" +
|
||||||
|
"<td align=\"right\">" + Math.round(marks[i][1].position.x * 100) + "%</td>" +
|
||||||
|
"<td style=\"color: green;\">" + vimperator.util.escapeHTML(marks[i][1].location) + "</td>" +
|
||||||
|
"</tr>";
|
||||||
|
}
|
||||||
|
list += "</table>";
|
||||||
|
|
||||||
|
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
//}}}
|
||||||
|
}; //}}}
|
||||||
|
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -144,23 +144,25 @@ vimperator.Search = function () //{{{
|
|||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["/"],
|
var modes = vimperator.config.browserModes || [vimperator.modes.NORMAL];
|
||||||
"Search forward for a pattern",
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["/"], "Search forward for a pattern",
|
||||||
function () { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_FORWARD); });
|
function () { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_FORWARD); });
|
||||||
|
|
||||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["?"],
|
vimperator.mappings.add(modes,
|
||||||
"Search backwards for a pattern",
|
["?"], "Search backwards for a pattern",
|
||||||
function () { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_BACKWARD); });
|
function () { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_BACKWARD); });
|
||||||
|
|
||||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["n"],
|
vimperator.mappings.add(modes,
|
||||||
"Find next",
|
["n"], "Find next",
|
||||||
function () { vimperator.search.findAgain(false); });
|
function () { vimperator.search.findAgain(false); });
|
||||||
|
|
||||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["N"],
|
vimperator.mappings.add(modes,
|
||||||
"Find previous",
|
["N"], "Find previous",
|
||||||
function () { vimperator.search.findAgain(true); });
|
function () { vimperator.search.findAgain(true); });
|
||||||
|
|
||||||
vimperator.mappings.add([vimperator.modes.NORMAL, vimperator.modes.CARET, vimperator.modes.TEXTAREA], ["*"],
|
vimperator.mappings.add(modes.concat([vimperator.modes.CARET, vimperator.modes.TEXTAREA]), ["*"],
|
||||||
"Find word under cursor",
|
"Find word under cursor",
|
||||||
function ()
|
function ()
|
||||||
{
|
{
|
||||||
@@ -168,7 +170,7 @@ vimperator.Search = function () //{{{
|
|||||||
vimperator.search.findAgain();
|
vimperator.search.findAgain();
|
||||||
});
|
});
|
||||||
|
|
||||||
vimperator.mappings.add([vimperator.modes.NORMAL, vimperator.modes.CARET, vimperator.modes.TEXTAREA], ["#"],
|
vimperator.mappings.add(modes.concat([vimperator.modes.CARET, vimperator.modes.TEXTAREA]), ["#"],
|
||||||
"Find word under cursor backwards",
|
"Find word under cursor backwards",
|
||||||
function ()
|
function ()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,12 +26,11 @@ 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.
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
vimperator.Mail = function (validModes)
|
vimperator.Mail = function ()
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
var modes = validModes || [vimperator.modes.NORMAL];
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// OPTIONS /////////////////////////////////////////////////
|
////////////////////// OPTIONS /////////////////////////////////////////////////
|
||||||
@@ -47,6 +46,7 @@ vimperator.Mail = function (validModes)
|
|||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
var modes = vimperator.config.mailModes || [vimperator.modes.NORMAL];
|
||||||
|
|
||||||
vimperator.mappings.add(modes, ["<Return>", "i"],
|
vimperator.mappings.add(modes, ["<Return>", "i"],
|
||||||
"Focus message",
|
"Focus message",
|
||||||
|
|||||||
@@ -181,18 +181,6 @@ vimperator.Mappings = function () //{{{
|
|||||||
return mappingsIterator([vimperator.modes.NORMAL], main);
|
return mappingsIterator([vimperator.modes.NORMAL], main);
|
||||||
},
|
},
|
||||||
|
|
||||||
// FIXME: unused?
|
|
||||||
/*getDefaultIterator: function (mode)
|
|
||||||
{
|
|
||||||
return mappingsIterator(mode, main);
|
|
||||||
},
|
|
||||||
|
|
||||||
// FIXME: unused?
|
|
||||||
getUserIterator: function (mode)
|
|
||||||
{
|
|
||||||
return mappingsIterator(mode, user);
|
|
||||||
},*/
|
|
||||||
|
|
||||||
add: function (modes, keys, description, action, extra)
|
add: function (modes, keys, description, action, extra)
|
||||||
{
|
{
|
||||||
addMap (new vimperator.Map(modes, keys,
|
addMap (new vimperator.Map(modes, keys,
|
||||||
@@ -351,226 +339,6 @@ vimperator.Mappings = function () //{{{
|
|||||||
////////////////////// DEFAULT MAPPINGS ////////////////////////////////////////
|
////////////////////// DEFAULT MAPPINGS ////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
//
|
|
||||||
// NORMAL mode
|
|
||||||
// {{{
|
|
||||||
|
|
||||||
|
|
||||||
// move to bookmarks.js:
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["a"],
|
|
||||||
function ()
|
|
||||||
{
|
|
||||||
var title = "";
|
|
||||||
if (vimperator.buffer.title != vimperator.buffer.URL)
|
|
||||||
title = " -title=\"" + vimperator.buffer.title + "\"";
|
|
||||||
vimperator.commandline.open(":", "bmark " + vimperator.buffer.URL + title, vimperator.modes.EX);
|
|
||||||
},
|
|
||||||
{ shortHelp: "Open a prompt to bookmark the current URL" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["A"],
|
|
||||||
function () { vimperator.bookmarks.toggle(vimperator.buffer.URL); },
|
|
||||||
{ shortHelp: "Toggle bookmarked state of current URL" }
|
|
||||||
));
|
|
||||||
|
|
||||||
// move to vimperator.js:
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["~"],
|
|
||||||
function () { vimperator.open("~"); },
|
|
||||||
{ shortHelp: "Open home directory" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gh"],
|
|
||||||
function() { BrowserHome(); },
|
|
||||||
{ shortHelp: "Go home" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gH"],
|
|
||||||
function ()
|
|
||||||
{
|
|
||||||
var homepages = gHomeButton.getHomePage();
|
|
||||||
vimperator.open(homepages, /\bhomepage\b/.test(vimperator.options["activate"]) ?
|
|
||||||
vimperator.NEW_TAB : vimperator.NEW_BACKGROUND_TAB);
|
|
||||||
},
|
|
||||||
{ shortHelp: "Go home in a new tab" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gu"],
|
|
||||||
function (count)
|
|
||||||
{
|
|
||||||
function isDirectory(url)
|
|
||||||
{
|
|
||||||
if (/^file:\/|^\//.test(url))
|
|
||||||
{
|
|
||||||
//var strippedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
|
|
||||||
var file = vimperator.io.getFile(url);
|
|
||||||
if (!file.exists() || !file.isDirectory())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// for all other locations just check if the URL ends with /
|
|
||||||
return /\/$/.test(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count < 1)
|
|
||||||
count = 1;
|
|
||||||
|
|
||||||
var url = vimperator.buffer.URL;
|
|
||||||
for (var i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
if (isDirectory(url))
|
|
||||||
url = url.replace(/^(.*?:)(.*?)([^\/]+\/*)$/, "$1$2/");
|
|
||||||
else
|
|
||||||
url = url.replace(/^(.*?:)(.*?)(\/+[^\/]+)$/, "$1$2/");
|
|
||||||
}
|
|
||||||
url = url.replace(/^(.*:\/+.*?)\/+$/, "$1/"); // get rid of more than 1 / at the end
|
|
||||||
|
|
||||||
if (url == vimperator.buffer.URL)
|
|
||||||
{
|
|
||||||
vimperator.beep();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
vimperator.open(url);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
shortHelp: "Go to parent directory",
|
|
||||||
flags: vimperator.Mappings.flags.COUNT
|
|
||||||
}
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gU"],
|
|
||||||
function ()
|
|
||||||
{
|
|
||||||
var uri = content.document.location;
|
|
||||||
if (/(about|mailto):/.test(uri.protocol)) // exclude these special protocols for now
|
|
||||||
{
|
|
||||||
vimperator.beep();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
vimperator.open(uri.protocol + "//" + (uri.host || "") + "/");
|
|
||||||
},
|
|
||||||
{ shortHelp: "Go to the root of the website" }
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["o"],
|
|
||||||
function () { vimperator.commandline.open(":", "open ", vimperator.modes.EX); },
|
|
||||||
{ shortHelp: "Open one or more URLs in the current tab" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["O"],
|
|
||||||
function () { vimperator.commandline.open(":", "open " + vimperator.buffer.URL, vimperator.modes.EX); },
|
|
||||||
{ shortHelp: "Open one or more URLs in the current tab, based on current location" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["<C-l>"],
|
|
||||||
function () { vimperator.commands.redraw(); },
|
|
||||||
{ shortHelp: "Redraw the screen" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["t"],
|
|
||||||
function () { vimperator.commandline.open(":", "tabopen ", vimperator.modes.EX); },
|
|
||||||
{ shortHelp: "Open one or more URLs in a new tab" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["T"],
|
|
||||||
function () { vimperator.commandline.open(":", "tabopen " + vimperator.buffer.URL, vimperator.modes.EX); },
|
|
||||||
{ shortHelp: "Open one or more URLs in a new tab, based on current location" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["y"],
|
|
||||||
function () { vimperator.copyToClipboard(vimperator.buffer.URL, true); },
|
|
||||||
{ shortHelp: "Yank current location to the clipboard" }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL, vimperator.modes.VISUAL], ["Y"],
|
|
||||||
function ()
|
|
||||||
{
|
|
||||||
var sel = window.content.document.getSelection();
|
|
||||||
if (sel)
|
|
||||||
vimperator.copyToClipboard(sel, true);
|
|
||||||
else
|
|
||||||
vimperator.beep();
|
|
||||||
},
|
|
||||||
{ shortHelp: "Copy selected text" }
|
|
||||||
));
|
|
||||||
|
|
||||||
// move to quickmarks:
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["go"],
|
|
||||||
function (arg) { vimperator.quickmarks.jumpTo(arg, vimperator.CURRENT_TAB); },
|
|
||||||
{
|
|
||||||
shortHelp: "Jump to a QuickMark in the current tab",
|
|
||||||
flags: vimperator.Mappings.flags.ARGUMENT
|
|
||||||
}
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gn"],
|
|
||||||
function (arg)
|
|
||||||
{
|
|
||||||
vimperator.quickmarks.jumpTo(arg,
|
|
||||||
/\bquickmark\b/.test(vimperator.options["activate"]) ?
|
|
||||||
vimperator.NEW_TAB : vimperator.NEW_BACKGROUND_TAB);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
shortHelp: "Jump to a QuickMark in a new tab",
|
|
||||||
flags: vimperator.Mappings.flags.ARGUMENT
|
|
||||||
}
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["M"],
|
|
||||||
function (arg)
|
|
||||||
{
|
|
||||||
if (/[^a-zA-Z0-9]/.test(arg))
|
|
||||||
{
|
|
||||||
vimperator.beep();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
vimperator.quickmarks.add(arg, vimperator.buffer.URL);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
shortHelp: "Add new QuickMark for current URL",
|
|
||||||
flags: vimperator.Mappings.flags.ARGUMENT
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
// move to v.Marks:
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["m"],
|
|
||||||
function (arg)
|
|
||||||
{
|
|
||||||
if (/[^a-zA-Z]/.test(arg))
|
|
||||||
{
|
|
||||||
vimperator.beep();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
vimperator.marks.add(arg);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
shortHelp: "Set mark at the cursor position",
|
|
||||||
flags: vimperator.Mappings.flags.ARGUMENT
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
// history manipulation and jumplist, move to bookmarks.js
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["<C-o>"],
|
|
||||||
function (count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); },
|
|
||||||
{
|
|
||||||
shortHelp: "Go to an older position in the jump list",
|
|
||||||
flags: vimperator.Mappings.flags.COUNT
|
|
||||||
}
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["<C-i>"],
|
|
||||||
function (count) { vimperator.history.stepTo(count > 1 ? count : 1); },
|
|
||||||
{
|
|
||||||
shortHelp: "Go to a newer position in the jump list",
|
|
||||||
flags: vimperator.Mappings.flags.COUNT
|
|
||||||
}
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["H", "<A-Left>", "<M-Left>"],
|
|
||||||
function (count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); },
|
|
||||||
{
|
|
||||||
shortHelp: "Go back in the browser history",
|
|
||||||
flags: vimperator.Mappings.flags.COUNT
|
|
||||||
}
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["L", "<A-Right>", "<M-Right>"],
|
|
||||||
function (count) { vimperator.history.stepTo(count > 1 ? count : 1); },
|
|
||||||
{
|
|
||||||
shortHelp: "Go forward in the browser history",
|
|
||||||
flags: vimperator.Mappings.flags.COUNT
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
// }}}
|
|
||||||
// CARET mode, most commands should be moved to buffer.js i guess
|
// CARET mode, most commands should be moved to buffer.js i guess
|
||||||
// {{{
|
// {{{
|
||||||
|
|
||||||
@@ -1179,20 +947,6 @@ vimperator.Mappings = function () //{{{
|
|||||||
));
|
));
|
||||||
|
|
||||||
//}}}
|
//}}}
|
||||||
// COMMAND_LINE mode, move to ui.js
|
|
||||||
//{{{
|
|
||||||
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.COMMAND_LINE], ["<Space>"],
|
|
||||||
function () { return vimperator.editor.expandAbbreviation("c"); },
|
|
||||||
{ flags: vimperator.Mappings.flags.ALLOW_EVENT_ROUTING }
|
|
||||||
));
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.COMMAND_LINE], ["<C-]>", "<C-5>"],
|
|
||||||
function () { vimperator.editor.expandAbbreviation("c"); }, { }
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//}}} }}}
|
|
||||||
|
|
||||||
return mappingManager;
|
return mappingManager;
|
||||||
}; //}}}
|
}; //}}}
|
||||||
|
|||||||
@@ -32,12 +32,20 @@ vimperator.config = {
|
|||||||
hostApplication: "Thunderbird", // TODO: can this be found out otherwise?
|
hostApplication: "Thunderbird", // TODO: can this be found out otherwise?
|
||||||
|
|
||||||
/*** optional options, there are checked for existance and a fallback provided ***/
|
/*** optional options, there are checked for existance and a fallback provided ***/
|
||||||
|
features: ["hints", "mail", "marks"],
|
||||||
get browserModes() { return [vimperator.modes.MESSAGE]; },
|
get browserModes() { return [vimperator.modes.MESSAGE]; },
|
||||||
features: ["mail", "hints"],
|
|
||||||
get mainWidget() { return GetThreadTree(); }, // focusContent() focuses this widget
|
get mainWidget() { return GetThreadTree(); }, // focusContent() focuses this widget
|
||||||
mainWindowID: "messengerWindow", // used for :set titlestring
|
mainWindowID: "messengerWindow", // used for :set titlestring
|
||||||
dialogs: [],
|
dialogs: [],
|
||||||
guioptions: { m: ["mail-toolbar-menubar2"], T: ["mail-bar2"], f: ["folderPaneBox", "folderpane_splitter"], F: ["folderPaneHeader"] }
|
guioptions: { m: ["mail-toolbar-menubar2"], T: ["mail-bar2"], f: ["folderPaneBox", "folderpane_splitter"], F: ["folderPaneHeader"] },
|
||||||
|
|
||||||
|
init: function()
|
||||||
|
{
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL],
|
||||||
|
["o"], "Open one or more URLs",
|
||||||
|
function () { vimperator.commandline.open(":", "open ", vimperator.modes.EX); });
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ 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.
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
// do NOT create instances of this class yourself, use the helper method
|
// Do NOT create instances of this class yourself, use the helper method
|
||||||
// vimperator.options.add() instead
|
// vimperator.options.add() instead
|
||||||
vimperator.Option = function (names, description, type, defaultValue, getter, setter, validator, completer)
|
vimperator.Option = function (names, description, type, defaultValue, getter, setter, validator, completer)
|
||||||
{
|
{
|
||||||
@@ -103,8 +103,6 @@ vimperator.Option = function (names, description, type, defaultValue, getter, se
|
|||||||
}; //}}}
|
}; //}}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vimperator.Options = function () //{{{
|
vimperator.Options = function () //{{{
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -287,21 +285,6 @@ vimperator.Options = function () //{{{
|
|||||||
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: move to vim.js?
|
|
||||||
// this hack is only needed, because we need to do asynchronous loading of the .vimperatorrc
|
|
||||||
setInitialGUI: function ()
|
|
||||||
{
|
|
||||||
if (vimperator.config.name != "Vimperator")
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!guioptionsDone)
|
|
||||||
this.get("guioptions").reset();
|
|
||||||
if (!laststatusDone)
|
|
||||||
this.get("laststatus").reset();
|
|
||||||
if (!showtablineDone)
|
|
||||||
this.get("showtabline").reset();
|
|
||||||
},
|
|
||||||
|
|
||||||
listPrefs: function (onlyNonDefault, filter)
|
listPrefs: function (onlyNonDefault, filter)
|
||||||
{
|
{
|
||||||
if (!filter)
|
if (!filter)
|
||||||
|
|||||||
@@ -273,6 +273,21 @@ vimperator.CommandLine = function () //{{{
|
|||||||
validator: function (value) { return /^(sort|)$/.test(value); }
|
validator: function (value) { return /^(sort|)$/.test(value); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
var modes = [vimperator.modes.COMMAND_LINE];
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["<Space>"], "Expand command line abbreviation",
|
||||||
|
function () { return vimperator.editor.expandAbbreviation("c"); },
|
||||||
|
{ flags: vimperator.Mappings.flags.ALLOW_EVENT_ROUTING });
|
||||||
|
|
||||||
|
vimperator.mappings.add(modes,
|
||||||
|
["<C-]>", "<C-5>"], "Expand command line abbreviation",
|
||||||
|
function () { vimperator.editor.expandAbbreviation("c"); });
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ const vimperator = (function () //{{{
|
|||||||
log("preview window"); vimperator.previewwindow = vimperator.InformationList("vimperator-previewwindow", { incrementalFill: false, maxItems: 10 });
|
log("preview window"); vimperator.previewwindow = vimperator.InformationList("vimperator-previewwindow", { incrementalFill: false, maxItems: 10 });
|
||||||
log("buffer window"); vimperator.bufferwindow = vimperator.InformationList("vimperator-bufferwindow", { incrementalFill: false, maxItems: 10 });
|
log("buffer window"); vimperator.bufferwindow = vimperator.InformationList("vimperator-bufferwindow", { incrementalFill: false, maxItems: 10 });
|
||||||
log("statusline"); vimperator.statusline = vimperator.StatusLine();
|
log("statusline"); vimperator.statusline = vimperator.StatusLine();
|
||||||
log("buffer"); vimperator.buffer = vimperator.Buffer(vimperator.config.browserModes || [vimperator.modes.NORMAL]);
|
log("buffer"); vimperator.buffer = vimperator.Buffer();
|
||||||
log("editor"); vimperator.editor = vimperator.Editor();
|
log("editor"); vimperator.editor = vimperator.Editor();
|
||||||
log("autocommands"); vimperator.autocommands = vimperator.AutoCommands();
|
log("autocommands"); vimperator.autocommands = vimperator.AutoCommands();
|
||||||
log("io"); vimperator.io = vimperator.IO();
|
log("io"); vimperator.io = vimperator.IO();
|
||||||
@@ -500,7 +500,7 @@ const vimperator = (function () //{{{
|
|||||||
// optional modules
|
// optional modules
|
||||||
if (vimperator.has("bookmarks")) { log("bookmarks"); vimperator.bookmarks = vimperator.Bookmarks(); }
|
if (vimperator.has("bookmarks")) { log("bookmarks"); vimperator.bookmarks = vimperator.Bookmarks(); }
|
||||||
if (vimperator.has("history")) { log("history"); vimperator.history = vimperator.History(); }
|
if (vimperator.has("history")) { log("history"); vimperator.history = vimperator.History(); }
|
||||||
if (vimperator.has("mail")) { log("mail"); vimperator.mail = vimperator.Mail(vimperator.config.mailModes || [vimperator.modes.NORMAL]); }
|
if (vimperator.has("mail")) { log("mail"); vimperator.mail = vimperator.Mail(); }
|
||||||
if (vimperator.has("tabs")) { log("tabs"); vimperator.tabs = vimperator.Tabs(); }
|
if (vimperator.has("tabs")) { log("tabs"); vimperator.tabs = vimperator.Tabs(); }
|
||||||
if (vimperator.has("marks")) { log("marks"); vimperator.marks = vimperator.Marks(); }
|
if (vimperator.has("marks")) { log("marks"); vimperator.marks = vimperator.Marks(); }
|
||||||
if (vimperator.has("quickmarks")) { log("quickmarks"); vimperator.quickmarks = vimperator.QuickMarks(); }
|
if (vimperator.has("quickmarks")) { log("quickmarks"); vimperator.quickmarks = vimperator.QuickMarks(); }
|
||||||
|
|||||||
@@ -61,6 +61,27 @@ vimperator.config = {
|
|||||||
vimperator.open(matches[1] + newNum + matches[3]);
|
vimperator.open(matches[1] + newNum + matches[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL],
|
||||||
|
["y"], "Yank current location to the clipboard",
|
||||||
|
function () { vimperator.copyToClipboard(vimperator.buffer.URL, true); });
|
||||||
|
|
||||||
|
// opening websites
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL],
|
||||||
|
["o"], "Open one or more URLs",
|
||||||
|
function () { vimperator.commandline.open(":", "open ", vimperator.modes.EX); });
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["O"],
|
||||||
|
"Open one or more URLs, based on current location",
|
||||||
|
function () { vimperator.commandline.open(":", "open " + vimperator.buffer.URL, vimperator.modes.EX); });
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["t"],
|
||||||
|
"Open one or more URLs in a new tab",
|
||||||
|
function () { vimperator.commandline.open(":", "tabopen ", vimperator.modes.EX); });
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["T"],
|
||||||
|
"Open one or more URLs in a new tab, based on current location",
|
||||||
|
function () { vimperator.commandline.open(":", "tabopen " + vimperator.buffer.URL, vimperator.modes.EX); });
|
||||||
|
|
||||||
vimperator.mappings.add([vimperator.modes.NORMAL],
|
vimperator.mappings.add([vimperator.modes.NORMAL],
|
||||||
["<C-a>"], "Increment last number in URL",
|
["<C-a>"], "Increment last number in URL",
|
||||||
function (count) { incrementURL(count > 1 ? count : 1); },
|
function (count) { incrementURL(count > 1 ? count : 1); },
|
||||||
@@ -70,6 +91,82 @@ vimperator.config = {
|
|||||||
["<C-x>"], "Decrement last number in URL",
|
["<C-x>"], "Decrement last number in URL",
|
||||||
function (count) { incrementURL(-(count > 1 ? count : 1)); },
|
function (count) { incrementURL(-(count > 1 ? count : 1)); },
|
||||||
{ flags: vimperator.Mappings.flags.COUNT });
|
{ flags: vimperator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["~"],
|
||||||
|
"Open home directory",
|
||||||
|
function () { vimperator.open("~"); });
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["gh"],
|
||||||
|
"Open homepage",
|
||||||
|
function() { BrowserHome(); });
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["gH"],
|
||||||
|
"Open homepage in a new tab",
|
||||||
|
function ()
|
||||||
|
{
|
||||||
|
var homepages = gHomeButton.getHomePage();
|
||||||
|
vimperator.open(homepages, /\bhomepage\b/.test(vimperator.options["activate"]) ?
|
||||||
|
vimperator.NEW_TAB : vimperator.NEW_BACKGROUND_TAB);
|
||||||
|
});
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["gu"],
|
||||||
|
"Go to parent directory",
|
||||||
|
function (count)
|
||||||
|
{
|
||||||
|
function isDirectory(url)
|
||||||
|
{
|
||||||
|
if (/^file:\/|^\//.test(url))
|
||||||
|
{
|
||||||
|
//var strippedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
|
||||||
|
var file = vimperator.io.getFile(url);
|
||||||
|
if (!file.exists() || !file.isDirectory())
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for all other locations just check if the URL ends with /
|
||||||
|
return /\/$/.test(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count < 1)
|
||||||
|
count = 1;
|
||||||
|
|
||||||
|
var url = vimperator.buffer.URL;
|
||||||
|
for (var i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if (isDirectory(url))
|
||||||
|
url = url.replace(/^(.*?:)(.*?)([^\/]+\/*)$/, "$1$2/");
|
||||||
|
else
|
||||||
|
url = url.replace(/^(.*?:)(.*?)(\/+[^\/]+)$/, "$1$2/");
|
||||||
|
}
|
||||||
|
url = url.replace(/^(.*:\/+.*?)\/+$/, "$1/"); // get rid of more than 1 / at the end
|
||||||
|
|
||||||
|
if (url == vimperator.buffer.URL)
|
||||||
|
{
|
||||||
|
vimperator.beep();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vimperator.open(url);
|
||||||
|
},
|
||||||
|
{ flags: vimperator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["gU"],
|
||||||
|
"Go to the root of the website",
|
||||||
|
function ()
|
||||||
|
{
|
||||||
|
var uri = content.document.location;
|
||||||
|
if (/(about|mailto):/.test(uri.protocol)) // exclude these special protocols for now
|
||||||
|
{
|
||||||
|
vimperator.beep();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vimperator.open(uri.protocol + "//" + (uri.host || "") + "/");
|
||||||
|
});
|
||||||
|
|
||||||
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["<C-l>"],
|
||||||
|
"Redraw the screen",
|
||||||
|
function () { vimperator.commands.redraw(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user