[Vimperator] Cannot overwrite default map (0.6pre)

Martin Stubenschrott stubenschrott at gmx.net
Mon Feb 4 05:20:06 PST 2008


On Mon, Feb 04, 2008 at 09:47:44PM +0900, M.Terada wrote:
> javascript <<EOF
> vimperator.mappgins.add( new vimperator.Map
>   [vimperator.modes.NORMAL, vimperator.modes.VISUAL],
>   ['<C-c>'],
>   function(){
>     var sel = window.content.document.getSelection();
>     if(sel){
>       vimperator.copyToClipboard(sel);
>     } else {
>       BrowserStop();
>     }
>   },{
>     shortHelp: 'Copy selected text or stop loading'
>   }
> ));
> EOF

This reminds me, we really should support :map <silent> ... at some time
for these purposes. In that example you misspelled vimperator.mappgins.
instead of vimperator.mappings. but i don't think that's the cause of
your problem.

> I looked for the cause and found the method is "vimperator.events.onKeyPress"
> It's seemed that "isUniqueMapping" variable is added at version 0.6pre
> If added the above code, "isUniqueMapping" is setted to "false" at
> pressed <C-c>.

Ah, good catch, at some time :map <Right> gt stopped working, i think
that's related to your problem.

> Why that boolean variable had be added ?

I don't remeber exactly, but it had to do with either of:
a) g<esc>  did beep in the 0.6pre version before, but it shouldn't. Or
b) a change by Marco which started our macro work required that fix
later.

> And is there a solution ?

Yes, I (or somebody which comes first), needs to fix that
isUniqueMapping() function to work reliably. Your code is absolutely
right.

Nice you still like hacking vimperator :)

--
Martin


More information about the Vimperator mailing list