mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 13:48:00 +01:00
new a and A mappings
This commit is contained in:
1
NEWS
1
NEWS
@@ -8,6 +8,7 @@
|
|||||||
read up the new help for the f, F and ; commands for details
|
read up the new help for the f, F and ; commands for details
|
||||||
removed the following hint options: 'hintchars' 'maxhints'
|
removed the following hint options: 'hintchars' 'maxhints'
|
||||||
added the following hint options: 'hinttimeout'
|
added the following hint options: 'hinttimeout'
|
||||||
|
* new a and A mappings to deal with bookmarks
|
||||||
* added ]n and ]p to navigate to the next/previous document based on
|
* added ]n and ]p to navigate to the next/previous document based on
|
||||||
the regexp specified in 'nextpattern' and 'previouspattern' (thanks kidd)
|
the regexp specified in 'nextpattern' and 'previouspattern' (thanks kidd)
|
||||||
* abbreviations for text fields (:abbr etc.) (thanks calmar)
|
* abbreviations for text fields (:abbr etc.) (thanks calmar)
|
||||||
|
|||||||
@@ -148,6 +148,27 @@ vimperator.Bookmarks = function () //{{{
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
toggle: function(url)
|
||||||
|
{
|
||||||
|
if (!url)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var count = this.remove(url);
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
vimperator.commandline.echo("Removed bookmark: " + url, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_SINGLELINE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var title = vimperator.buffer.title || url;
|
||||||
|
var extra = "";
|
||||||
|
if (title != url)
|
||||||
|
extra = " (" + title + ")";
|
||||||
|
this.add(title, url);
|
||||||
|
vimperator.commandline.echo("Added bookmark: " + url + extra, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_SINGLELINE);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// returns number of deleted bookmarks
|
// returns number of deleted bookmarks
|
||||||
remove: function (url)
|
remove: function (url)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -605,7 +605,12 @@ vimperator.Commands = function () //{{{
|
|||||||
var tags = getOption(res.opts, "-tags", []);
|
var tags = getOption(res.opts, "-tags", []);
|
||||||
|
|
||||||
if (vimperator.bookmarks.add(title, url, keyword, tags))
|
if (vimperator.bookmarks.add(title, url, keyword, tags))
|
||||||
vimperator.echo("Bookmark `" + title + "' added with url `" + url + "'", vimperator.commandline.FORCE_SINGLELINE);
|
{
|
||||||
|
var extra = "";
|
||||||
|
if (title != url)
|
||||||
|
extra = " (" + title + ")";
|
||||||
|
vimperator.echo("Added bookmark: " + url + extra, vimperator.commandline.FORCE_SINGLELINE);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
vimperator.echoerr("Exxx: Could not add bookmark `" + title + "'", vimperator.commandline.FORCE_SINGLELINE);
|
vimperator.echoerr("Exxx: Could not add bookmark `" + title + "'", vimperator.commandline.FORCE_SINGLELINE);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -430,6 +430,20 @@ vimperator.Mappings = function () //{{{
|
|||||||
flags: vimperator.Mappings.flags.COUNT
|
flags: vimperator.Mappings.flags.COUNT
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["a"],
|
||||||
|
function () { vimperator.commandline.open(":", "bmark " + vimperator.buffer.URL, vimperator.modes.EX); },
|
||||||
|
{
|
||||||
|
short_help: "Open a prompt to bookmark the current URL",
|
||||||
|
help: "Look at <code class='command'>:bmark</code> for more information."
|
||||||
|
}
|
||||||
|
));
|
||||||
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["A"],
|
||||||
|
function () { vimperator.bookmarks.toggle(vimperator.buffer.URL); },
|
||||||
|
{
|
||||||
|
short_help: "Toggle bookmarked state of current URL",
|
||||||
|
help: "Add/remove a bookmark for the current location, depending if it already is bookmarked or not."
|
||||||
|
}
|
||||||
|
));
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["b"],
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["b"],
|
||||||
function () { vimperator.commandline.open(":", "buffer! ", vimperator.modes.EX); },
|
function () { vimperator.commandline.open(":", "buffer! ", vimperator.modes.EX); },
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user