Strange key sequence behaviour

4 views
Skip to first unread message

Steve

unread,
Apr 15, 2011, 3:41:00 AM4/15/11
to vim
Hi,

I've been experiencing a strange behaviour when typing several keys
*quickly*. The email address I use for mailing lists is the one I use
here. From time to time, I have to type it in a message. And lastly,
when I type it *quickly*, the screen just erases itself, leaving a blank
screen and I loose total control over it. The only solution is to
manually close is. The strange thing is that if I type slowly, this
behaviour doesn't happen. So to sum up: typing

dlist@

triggers the strange behaviour (it's at the @ caracter).


I've noticed that the cursor stays say a second on the last caracter
typed then move one space to the right, but not with all caracters.
Example are 's', 'd'. Other caracters don't show this.

I don't know how to troubleshoot this.

Any help would be greatly appreciated.

Have nice day,
Steve


Tony Mechelynck

unread,
Apr 15, 2011, 5:24:48 AM4/15/11
to vim

"Waiting one second" is a typical behaviour when Vim is waiting to see
whether you'll type the {lhs} of a multi-character mapping.

- Do you sometimes forget to set Insert mode before typing this address?

- If the "one second wait" happens, let's say, at the letter s (but not
at the i preceding it), try

:verbose map s
:verbose map! s

(the former will give you mappings for Normal, Visual, Select and
Operator-Pending modes, the latter for Insert/Replace and Command-line
modes, so use both). Similarly for d etc.


Best regards,
Tony.
--
Oh, I don't blame Congress. If I had $600 billion at my disposal, I'd
be irresponsible, too.
-- Lichty & Wagner

Steve

unread,
Apr 15, 2011, 8:27:59 AM4/15/11
to vim
Hi Tony,

Thanks for your answer.


> >I've been experiencing a strange behaviour when typing several keys
> >*quickly*. The email address I use for mailing lists is the one I use
> >here. From time to time, I have to type it in a message. And lastly,
> >when I type it *quickly*, the screen just erases itself, leaving a blank
> >screen and I loose total control over it. The only solution is to
> >manually close is. The strange thing is that if I type slowly, this
> >behaviour doesn't happen. So to sum up: typing
> >
> >dlist@
> >
> >triggers the strange behaviour (it's at the @ caracter).
> >
> >
> >I've noticed that the cursor stays say a second on the last caracter
> >typed then move one space to the right, but not with all caracters.
> >Example are 's', 'd'. Other caracters don't show this.
> >
> >I don't know how to troubleshoot this.
> >
> >Any help would be greatly appreciated.
> >
> >Have nice day,
> >Steve
> >
> >
>
> "Waiting one second" is a typical behaviour when Vim is waiting to
> see whether you'll type the {lhs} of a multi-character mapping.
>
> - Do you sometimes forget to set Insert mode before typing this address?

No, this happens only in Insert mode.



> - If the "one second wait" happens, let's say, at the letter s (but
> not at the i preceding it), try

I changed s for d.

> :verbose map d

Nothing

> :verbose map! d

It shows my mapping which is

! dlist <dl...@bluewin.ch>

which I put in ~/.vim/mappings

If I comment out this line, the problem dissapears. The strange thing is
that I have other mappings for email addresses, but no problem with
those.


Strange isn't it?

Thanks for your help,
steve

Tony Mechelynck

unread,
Apr 15, 2011, 9:06:02 AM4/15/11
to vim

Well, I guess with a different {lhs}, for instance

:inoremap !d dl...@bluewin.ch

it will probably work.

Or else, maybe it's just a missing refresh: try (in Insert mode) Esc
Ctrl-L a if the screen gets blank again.


Best regards,
Tony.
--
*** NEWSFLASH ***
Russian tanks steamrolling through New Jersey!!!! Details at eleven!

Ben Schmidt

unread,
Apr 15, 2011, 9:09:00 AM4/15/11
to vim
>> :verbose map! d
>
> It shows my mapping which is
>
> ! dlist <dl...@bluewin.ch>
>
> which I put in ~/.vim/mappings
>
> If I comment out this line, the problem dissapears. The strange thing is
> that I have other mappings for email addresses, but no problem with
> those.

I guess you've got a recursive mapping there, since the right hand side
includes the left hand side. It only happens when you type fast because
the mapping doesn't timeout.

Try

:noremap! dlist <dl...@bluewin.ch>

instead of just :map! ...

Ben.

Tony Mechelynck

unread,
Apr 15, 2011, 9:14:40 AM4/15/11
to vim...@googlegroups.com, Ben Schmidt

Ben, what you're saying ought not to happen: ":help recursive-mapping"
says that if the {rhs} _starts_ with the {lhs} there is no recursion.

Best regards,
Tony.
--
"OK, now let's look at four dimensions on the blackboard."
-- Dr. Joy

Ben Schmidt

unread,
Apr 15, 2011, 9:17:17 AM4/15/11
to vim...@googlegroups.com, Tony Mechelynck
>>> It shows my mapping which is
>>>
>>> ! dlist <dl...@bluewin.ch>
>>>
>>> which I put in ~/.vim/mappings
>>>
>>> If I comment out this line, the problem dissapears. The strange thing is
>>> that I have other mappings for email addresses, but no problem with
>>> those.
>>
>> I guess you've got a recursive mapping there, since the right hand side
>> includes the left hand side. It only happens when you type fast because
>> the mapping doesn't timeout.
>>
>> Try
>>
>> :noremap! dlist <dl...@bluewin.ch>
>>
>> instead of just :map! ...
>
> Ben, what you're saying ought not to happen: ":help recursive-mapping"
> says that if the {rhs} _starts_ with the {lhs} there is no recursion.

That isn't the case here. The LHS starts with 'd', the RHS starts with
'<'.

Ben.

Tony Mechelynck

unread,
Apr 15, 2011, 10:09:41 AM4/15/11
to Ben Schmidt, vim...@googlegroups.com

Ah, right.


Best regards,
Tony.
--
Connector Conspiracy, n:
[probably came into prominence with the appearance of the
KL-10, none of whose connectors match anything else] The tendency of
manufacturers (or, by extension, programmers or purveyors of anything)
to come up with new products which don't fit together with the old
stuff, thereby making you buy either all new stuff or expensive
interface devices.

Steve

unread,
Apr 15, 2011, 10:14:52 AM4/15/11
to vim
Le 15-04-2011, à 23:09:00 +1000, Ben Schmidt (mail_ben...@yahoo.com.au) a écrit :

> >> :verbose map! d
> >
> >It shows my mapping which is
> >
> >! dlist <dl...@bluewin.ch>
> >
> >which I put in ~/.vim/mappings
> >
> >If I comment out this line, the problem dissapears. The strange thing is
> >that I have other mappings for email addresses, but no problem with
> >those.
>
> I guess you've got a recursive mapping there, since the right hand side
> includes the left hand side. It only happens when you type fast because
> the mapping doesn't timeout.

Not sure I've understood, but


> Try
>
> :noremap! dlist <dl...@bluewin.ch>
>
> instead of just :map! ...

that works perfectly !

Thanks to all of you.

steve

Tony Mechelynck

unread,
Apr 15, 2011, 10:36:26 AM4/15/11
to vim
On 15/04/11 16:14, Steve wrote:
> Le 15-04-2011, � 23:09:00 +1000, Ben Schmidt (mail_ben...@yahoo.com.au) a �crit :

>
>>>> :verbose map! d
>>>
>>> It shows my mapping which is
>>>
>>> ! dlist<dl...@bluewin.ch>
>>>
>>> which I put in ~/.vim/mappings
>>>
>>> If I comment out this line, the problem dissapears. The strange thing is
>>> that I have other mappings for email addresses, but no problem with
>>> those.
>>
>> I guess you've got a recursive mapping there, since the right hand side
>> includes the left hand side. It only happens when you type fast because
>> the mapping doesn't timeout.
>
> Not sure I've understood, but
[...]

You mapped dlist to <dl...@bluewin.ch> but the {rhs} is reexamined for
mappings: so

dlist
becomes
<dl...@bluewin.ch>
becomes
<<dl...@bluewin.ch>@bluewin.ch>
becomes
<<<dl...@bluewin.ch>@bluewin.ch>@bluewin.ch>
becomes
<<<<dl...@bluewin.ch>@bluewin.ch>@bluewin.ch>@bluewin.ch>

and so on, until either Vim reaches 'maxmapdepth' repeats (1000 by
default) or its memory is exhausted, whichever happens first.

Using :noremap! or :inoremap instead, the {rhs} is not remapped, and
there is no recursion.

see
:help recursive-mapping
:help 'maxmapdepth'


Best regards,
Tony.
--
Corruption is not the #1 priority of the Police Commissioner. His job
is to enforce the law and fight crime.
-- P.B.A. President E. J. Kiernan

Steve

unread,
Apr 18, 2011, 3:41:04 AM4/18/11
to vim
Le 15-04-2011, à 16:36:26 +0200, Tony Mechelynck (antoine.m...@gmail.com) a écrit :

> On 15/04/11 16:14, Steve wrote:

That's very clear an explanation.

Thanks Tony.

Have a nice day,
Steve

Reply all
Reply to author
Forward
0 new messages