[Vimperator] Configurable hints for vimperator 0.6
Martin Stubenschrott
stubenschrott at gmx.net
Wed Apr 30 12:36:34 PDT 2008
Daniel Trstenjak wrote:
> Hi Martin,
>
> I have made the desired changes:
> - added documentation to 'options.txt'
> - changed the code style issues
> - removed focusedhintstyle option
>
> Also I changed 'char-hints.js' so that the options
> 'hintstyle/{activelink,link}{fg,bg}color' are considered.
Wow, all things mentioned are really cool! Thanks.
> I have to admit, I'm not proud of the color options. I just wanted to
> get as fast as possible rid of the yellow background. It's okay if
> it's just a temporary solution.
Right, often temporary solutions tend to become permanent ones, but it's
better than having nothing. :highlight could still be implemented later.
> In terms of vim, a colorscheme is just a group of highlight definitions.
> So I don't understand why the colorscheme command should be easier to
> implement then the highlight command.
Well, I meant :colorscheme needs :highlight, and writing the :highlight
code is harder. When that is done, a :colorscheme command is simple.
>> Actually the future plan for hints would be to match hints with some
>> heuristics. The plan is to prefer matches for shorter links where the
>> hint text appears at the beginning or at least at the start of a word
>> boundary. However, since I don't know when I find time for that, maybe
>> this option would be a good start although I really think a good
>> heuristics would be better than that option (but harder to code as well ;)).
>
> Should the heuristics only choose the active link, or also execute it.
> For example, if you have two links which match with the hintstring 'be'.
> The frist link matches at the beginning, and the second in the middle.
> If matching at the beginning is prefered, should then the first link
> directly be executed, or should it only be activated? Directly executing
> the link could induce unanticipated behavoir.
Only activated. See below.
> It's okay to have such a heuristics. But I think it's nice to have this
> part of vimperator configurable. To try different approaches by just
> replacing a javascript function.
Right, I think you persuaded me, especially since my planned heuristics
with giving each item a score between 0 and 1 is much harder anyway. The
ideas was to give all matched hints a certain score, with the following
items prefered:
1.) when the hinttext is at the start of the link
2.) if that's not the case then higher scores if the hinttext is at a
word boundary of the link.
3.) Shorter links also get a higher score.
Then the hints would just be sorted with the highest score, so that hint
number 1 (the green one) should be quickly that one, which you want, and
you can just press enter when the link turned green even if it is not
unique.
But well, I think for now I just go with your patch and a add a third
hintmatcher: wordboundary, so a link "This is vimperator" would be
matched by "vimp" but not by "imp".
Actually very nice idea to make the hint matcher configurable.
I'll probably need some days to test the patch and add this thing, then
it should go in and you should end up in the AUTHORS file then as an
official vimperator developer :)
thanks again for the patch, really well written. Looking forward for
more of such great patches :)
--
Martin
More information about the Vimperator
mailing list