Search code examples
javascriptcssfirefoxvimperator

Hint StackExchange voting buttons with Pentadactyl


How can I get Pentadactyl (a fork of Vimperator) to hint voting arrows on StackExchange?

For example, I want to upvote this question and answer but Pentadactyl does not provide hinting for the voting arrow buttons even after I removed my .pentadactylrc file and restarted Firefox.

Is there any way to view the currently mapped keys in Vim?

I think I'm not getting hinting for any questions but I'm not 100% sure. I've never had problems with Vimperator on StackOverflow and I expect that Pentadactyl should have most if not all of the features that Vimperator does.

I suspect that the description of the hinttags' 'ht' setting on this page describing Pentadactyl settings is the key to figuring this out.

http://5digits.org/help/pentadactyl/options.xhtml

Unfortunately I wouldn't know a CSS selector or XPath expression from my own elbow. Is this the solution and if so, what CSS selector describes a SO voting button? If not, what is the solution?


Solution

  • Run the following command.

    :set hinttags+=a[class]

    Add this line to your pentadactylrc to make it permanent.

    a[class] is a CSS selector in the format tag[attribute="value"]. So it matches all anchor tags with the class attribute on the page.

    If you inspect the source of this page you'll see the voting arrows are described with:

    <a class="vote-up-off" title="This answer is useful">up vote</a>

    If you want to match specifically the voting arrows and star on StackExchange pages use:

    :set hinttags+=a[class^="vote"],a[class^="star"]

    This uses regular expressions to match anchor tags with class attributes beginning with 'vote' and 'star'.