[Vimperator] [PATCH] added ; AAY to yank text description in extended hints mode
Bart Trojanowski
bart at jukie.net
Sat Apr 28 09:01:45 PDT 2007
Hi. I sometimes found myself using the mouse (the horror!) to highlight
text of an url. I added 'Y' as an operator in extended hint mode to
yank the text of an url. 'y' still yanks the url itself.
-Bart
---
src/chrome/content/vimperator/commands.js | 4 +++-
src/chrome/content/vimperator/hints.js | 18 +++++++++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/chrome/content/vimperator/commands.js b/src/chrome/content/vimperator/commands.js
index 881ff6d..ce4e356 100644
--- a/src/chrome/content/vimperator/commands.js
+++ b/src/chrome/content/vimperator/commands.js
@@ -816,6 +816,7 @@ var g_mappings = [/*{{{*/
"Then press <code>AB</code> to select the hint. Now press <code class=mapping>y</code> to yank its location.<br/>"+
"Actions for selected hints in ExtendedHint mode are:<br/>"+
"<ul><li><code class=mapping>y</code> to yank its location</li>"+
+ " <li><code class=mapping>Y</code> to yank its text description</li>"+
" <li><code class=mapping>o</code> to open its location in the current tab</li>"+
" <li><code class=mapping>t</code> to open its location in a new tab</li>"+
" <li><code class=mapping>O</code> to open its location in an <code class=command>:open</code> query (not implemented yet)</li>"+
@@ -985,7 +986,8 @@ var g_hint_mappings = [ /*{{{*/
["t", "hah.openHints(true, false);", true, false],
["<C-w>", "hah.openHints(false, true );", true, false],
["s", "echoerr('Saving of links not yet implemented');", true, false],
- ["y", "hah.yankHints();", true, false],
+ ["y", "hah.yankUrlHints();", true, false],
+ ["Y", "hah.yankTextHints();", true, false],
[",", "g_inputbuffer+=','; hah.setCurrentState(0);", false, true],
[":", "openVimperatorBar(null);", false, true],
/* movement keys */
diff --git a/src/chrome/content/vimperator/hints.js b/src/chrome/content/vimperator/hints.js
index b0d1198..450462b 100644
--- a/src/chrome/content/vimperator/hints.js
+++ b/src/chrome/content/vimperator/hints.js
@@ -512,7 +512,7 @@ function hit_a_hint()
return 0;
};
- this.yankHints = function()
+ this.yankUrlHints = function()
{
var loc = "";
var elems = hah.hintedElements();
@@ -528,6 +528,22 @@ function hit_a_hint()
echo("Yanked " + loc);
};
+ this.yankTextHints = function()
+ {
+ var loc = "";
+ var elems = hah.hintedElements();
+ var tmp = "";
+ for(i=0; i<elems.length; i++)
+ {
+ tmp = elems[i].refElem.textContent;
+ if (typeof(tmp) != 'undefined' && tmp.length > 0)
+ loc += tmp + "\n";
+ }
+
+ copyToClipboard(loc);
+ echo("Yanked " + loc);
+ };
+
function setMouseOverElement(elem)
{
var doc = window.document;
--
1.5.2.rc0.56.g6169a
More information about the Vimperator
mailing list