mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 22:57:58 +01:00
<leader> toggles the escape-numbers mode in hints
This commit is contained in:
@@ -1314,12 +1314,7 @@ vimperator.Commands = function () //{{{
|
|||||||
var leaderRegexp = /<Leader>/i;
|
var leaderRegexp = /<Leader>/i;
|
||||||
|
|
||||||
if (leaderRegexp.test(lhs))
|
if (leaderRegexp.test(lhs))
|
||||||
{
|
lhs = lhs.replace(leaderRegexp, vimperator.events.getMapLeader());
|
||||||
var leaderRef = vimperator.variableReference("mapleader");
|
|
||||||
var leader = leaderRef[0] ? leaderRef[0][leaderRef[1]] : "\\";
|
|
||||||
|
|
||||||
lhs = lhs.replace(leaderRegexp, leader);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rhs)
|
if (rhs)
|
||||||
{
|
{
|
||||||
@@ -1481,6 +1476,9 @@ vimperator.Commands = function () //{{{
|
|||||||
for (var abbrCmd in vimperator.editor.abbreviations)
|
for (var abbrCmd in vimperator.editor.abbreviations)
|
||||||
line += abbrCmd;
|
line += abbrCmd;
|
||||||
|
|
||||||
|
// if (vimperator.events.getMapLeader() != "\\")
|
||||||
|
// line += "\nlet mapleader = \"" + vimperator.events.getMapLeader() + "\"\n";
|
||||||
|
|
||||||
// source a user .vimperatorrc file
|
// source a user .vimperatorrc file
|
||||||
line += "\nsource! " + filename + ".local\n";
|
line += "\nsource! " + filename + ".local\n";
|
||||||
line += "\n\" vim: set ft=vimperator:";
|
line += "\n\" vim: set ft=vimperator:";
|
||||||
|
|||||||
@@ -425,6 +425,12 @@ vimperator.Events = function () //{{{
|
|||||||
return (key == "<Esc>" || key == "<C-[>" || key == "<C-c>");
|
return (key == "<Esc>" || key == "<C-[>" || key == "<C-c>");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getMapLeader: function ()
|
||||||
|
{
|
||||||
|
var leaderRef = vimperator.variableReference("mapleader");
|
||||||
|
return leaderRef[0] ? leaderRef[0][leaderRef[1]] : "\\";
|
||||||
|
},
|
||||||
|
|
||||||
// argument "event" is delibarately not used, as i don't seem to have
|
// argument "event" is delibarately not used, as i don't seem to have
|
||||||
// access to the real focus target
|
// access to the real focus target
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ vimperator.Hints = function () //{{{
|
|||||||
|
|
||||||
function updateStatusline()
|
function updateStatusline()
|
||||||
{
|
{
|
||||||
vimperator.statusline.updateInputBuffer((escapeNumbers ? "\\ ": "") + // sign for escapeNumbers
|
vimperator.statusline.updateInputBuffer((escapeNumbers ? vimperator.events.getMapLeader() + " ": "") + // sign for escapeNumbers
|
||||||
(hintString ? "\"" + hintString + "\"" : "") +
|
(hintString ? "\"" + hintString + "\"" : "") +
|
||||||
(hintNumber > 0 ? " <" + hintNumber + ">" : ""));
|
(hintNumber > 0 ? " <" + hintNumber + ">" : ""));
|
||||||
}
|
}
|
||||||
@@ -591,7 +591,7 @@ vimperator.Hints = function () //{{{
|
|||||||
hintNumber = 0;
|
hintNumber = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "\\":
|
case vimperator.events.getMapLeader():
|
||||||
escapeNumbers = !escapeNumbers;
|
escapeNumbers = !escapeNumbers;
|
||||||
if (escapeNumbers && usedTabKey) // hintNumber not used normally, but someone may wants to toggle
|
if (escapeNumbers && usedTabKey) // hintNumber not used normally, but someone may wants to toggle
|
||||||
hintNumber = 0; // <tab>s ? reset. Prevent to show numbers not entered.
|
hintNumber = 0; // <tab>s ? reset. Prevent to show numbers not entered.
|
||||||
|
|||||||
@@ -1129,9 +1129,10 @@ vimperator.Mappings = function () //{{{
|
|||||||
{
|
{
|
||||||
shortHelp: "Start QuickHint mode",
|
shortHelp: "Start QuickHint mode",
|
||||||
usage: ["f{hint}"],
|
usage: ["f{hint}"],
|
||||||
help: "In QuickHint mode, every hintable item (according to the <code class=\"option\">'hinttags'</code> XPath query) is assigned a unique number (FIXME: numbers shown, but not usable yet).<br/>" +
|
help: "In QuickHint mode, every hintable item (according to the <code class=\"option\">'hinttags'</code> XPath query) is assigned a unique number.<br/>" +
|
||||||
"You can now either type this number or type any part of the URL which you want to follow, and it is followed as soon as it can be uniquely identified. " +
|
"You can now either type this number or type any part of the URL which you want to follow, and it is followed as soon as it can be uniquely identified. " +
|
||||||
"Often it is can be useful to combine these techniques to narrow down results with some letters, and then typing a single digit to make the match unique.<br/>" +
|
"Often it is can be useful to combine these techniques to narrow down results with some letters, and then typing a single digit to make the match unique.<br/>" +
|
||||||
|
"Pressing <leader> (defaults to :let mapleader = \"\\\") toggles 'escape-mode', where numbers are treated as normal text.<br/>" +
|
||||||
"<code class=\"mapping\"><Esc></code> stops this mode at any time."
|
"<code class=\"mapping\"><Esc></code> stops this mode at any time."
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|||||||
Reference in New Issue
Block a user