public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: updated vim broke arrow/delete keys
@ 2016-09-04 15:19 Felipe M. Vieira
  2016-09-04 20:48 ` Brian Inglis
  0 siblings, 1 reply; 7+ messages in thread
From: Felipe M. Vieira @ 2016-09-04 15:19 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 850 bytes --]

Erik,

The motive:
http://learnvimscriptthehardway.stevelosh.com/chapters/10.html
The idea is to force yourself to use a faster escape key.

Gary,

the output of that command:
    
  timeoutlen=1000
  ttimeoutlen=-1

I guess the final answer is the one from Randy Morris:
https://stackoverflow.com/questions/8488232/how-to-disable-esc-and-cursor-keys-in-vim

"In conclusion, don't remap escape, I almost guarantee you will have unexpected consequences."

It feels like <esc> and some other keys are a combination of other keys as Erik
pointed out.

I'm going to send an email to the author of vimscript to add a warning or
something like that.

Thanks for all the help again guys.

Best,
-- 
Felipe Martins Vieira
Public PGP key: http://pgp.surfnet.nl
Key Fingerprint: 9640 F192 63DA D637 6750 AC08 7BCA 19BB 0E69 E45D

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: updated vim broke arrow/delete keys
  2016-09-04 15:19 updated vim broke arrow/delete keys Felipe M. Vieira
@ 2016-09-04 20:48 ` Brian Inglis
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Inglis @ 2016-09-04 20:48 UTC (permalink / raw)
  To: cygwin

On 2016-09-04 09:19, Felipe M. Vieira wrote:
> The motive:
> http://learnvimscriptthehardway.stevelosh.com/chapters/10.html

If the title alone does not put you off, it should be a warning,
and the author warns it is not a tutorial, it is one way to learn
how to customize vim, and I would add, should be done in a sandbox:
a separate account from your working account, and only after reading
the whole article from start to finish before trying anything,
as the impact of the changes is nowhere clearly explained, just what
the immediate effect is and whay that is considered desirable by the
author.

> The idea is to force yourself to use a faster escape key.
> the output of that command:
>   timeoutlen=1000
>   ttimeoutlen=-1
> I guess the final answer is the one from Randy Morris:
> https://stackoverflow.com/questions/8488232/how-to-disable-esc-and-cursor-keys-in-vim
> "In conclusion, don't remap escape, I almost guarantee you will have unexpected consequences."
> It feels like <esc> and some other keys are a combination of other keys as Erik
> pointed out.
> I'm going to send an email to the author of vimscript to add a warning or
> something like that.

Send the email to the author of the article Steve Losh, and
suggest his article could be improved by discussing the impact
of his changes, and not just the immediate effect; I suspect
the author of vim and its scripting language Bram Moolenaar
would be unlikely to suggest remapping <esc>!

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: updated vim broke arrow/delete keys
  2016-09-02 21:43 Felipe Vieira
  2016-09-02 22:38 ` Erik Soderquist
@ 2016-09-02 23:12 ` Gary Johnson
  1 sibling, 0 replies; 7+ messages in thread
From: Gary Johnson @ 2016-09-02 23:12 UTC (permalink / raw)
  To: cygwin

On 2016-09-02, Felipe Vieira wrote:
> Dear Gary,
> 
> you are absolutely right. Vim is not the problem.
> 
> I did two changes at the same time and indeed tried the vim -u none
> but maybe did not catch the error.
> 
> Finally what causes the error is:
> 
> inoremap <esc> <Nop>
> 
> no my vimrc. From http://vimdoc.sourceforge.net/htmldoc/map.html:
> 
> *<Nop>*
> A easier way to get a mapping that doesn't produce anything, is to use "<Nop>".
> 
> Anyways this is not the expected behavior. Is there some complexity
> here that I'm not capturing? In theory I'm disabling the <esc> key and
> that's all. Why is it interfering with m arrow keys and the del key?

The escape character alone in insert mode changes the mode to
normal.  The escape character may also begin an "escape sequence"
when it is followed "immediately" by certain other characters.

Vim determines whether an escape character is intended to be
interpreted alone or as the beginning of an escape sequence by
waiting only so long for the next character following the escape.
If the next character arrives after some time limit, the escape is
processed as a single escape and subsequent characters are processed
as themselves rather than part of an escape sequence.

In your case, it appears that the characters following the escape in
the escape sequences for the arrow and delete keys are arriving
after that time limit.  That time limit is set by the 'ttimeoutlen'
option, or by the 'timeoutlen' option if the value of 'ttimeoutlen'
is negative.  See ":help 'ttimeoutlen'".  This timeout defaults to 1
second, which should be plenty of time for a terminal emulator such
as mintty to send an escape sequence.

What do you see when you execute this?

    :verbose set timeoutlen? ttimeoutlen?

Regards,
Gary


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: updated vim broke arrow/delete keys
  2016-09-02 21:43 Felipe Vieira
@ 2016-09-02 22:38 ` Erik Soderquist
  2016-09-02 23:12 ` Gary Johnson
  1 sibling, 0 replies; 7+ messages in thread
From: Erik Soderquist @ 2016-09-02 22:38 UTC (permalink / raw)
  To: cygwin

On Fri, Sep 2, 2016 at 5:43 PM, Felipe Vieira wrote:
> no my vimrc. From http://vimdoc.sourceforge.net/htmldoc/map.html:
>
> *<Nop>*
> A easier way to get a mapping that doesn't produce anything, is to use "<Nop>".
>
> Anyways this is not the expected behavior. Is there some complexity
> here that I'm not capturing? In theory I'm disabling the <esc> key and
> that's all. Why is it interfering with m arrow keys and the del key?


If I recall correctly, some keys, including the arrows and DEL, are
actually a very fast combination of other keys, and if you could type
fast enough, you could do the same thing by hitting the corresponding
key sequence.  This would also result in effectively disabling all
keys that depend on ESC being the first character of a sequence if you
disable ESC.

Might I ask why you would want to disable ESC in vi?

-- Erik

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: updated vim broke arrow/delete keys
@ 2016-09-02 21:43 Felipe Vieira
  2016-09-02 22:38 ` Erik Soderquist
  2016-09-02 23:12 ` Gary Johnson
  0 siblings, 2 replies; 7+ messages in thread
From: Felipe Vieira @ 2016-09-02 21:43 UTC (permalink / raw)
  To: cygwin, garyjohn

Dear Gary,

you are absolutely right. Vim is not the problem.

I did two changes at the same time and indeed tried the vim -u none
but maybe did not catch the error.

Finally what causes the error is:

inoremap <esc> <Nop>

no my vimrc. From http://vimdoc.sourceforge.net/htmldoc/map.html:

*<Nop>*
A easier way to get a mapping that doesn't produce anything, is to use "<Nop>".

Anyways this is not the expected behavior. Is there some complexity
here that I'm not capturing? In theory I'm disabling the <esc> key and
that's all. Why is it interfering with m arrow keys and the del key?

Best regards,

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: updated vim broke arrow/delete keys
  2016-09-02 15:04 Felipe Vieira
@ 2016-09-02 16:21 ` Gary Johnson
  0 siblings, 0 replies; 7+ messages in thread
From: Gary Johnson @ 2016-09-02 16:21 UTC (permalink / raw)
  To: cygwin

On 2016-09-02, Felipe Vieira wrote:
> Dear all,
> 
> I just updated my vim and some keys are now broken.
> 
> I'm trying both versions of vim:
> vim-7.4.2181-1.tar.xz 07-Aug-2016 21:13 1062348
> and
> vim-7.4.1990-1.tar.xz                              06-Jul-2016 20:31
>           1055584
> but both now broke the arrow keys/delete in insert mode.
> 
> Up arrow inserts "OA" as text, del inserts "[3~".
> 
> How can I fix these and revert to what was before?
> 
> I'm assuming my version of vim was even older than those.

They work fine for me.  It could be that something else changed at
the same time that you updated vim.

What terminal are you running in?

I started a Cygwin shell in mintty and ran vim 7.4.2181 as

    $ vim -N -u NONE

to get rid of the influence of any configuration files, then entered
some text.  The left, right, up and down arrows and delete all work
as expected in insert mode.

Executing

    :set termcap

will show you the character sequences vim expects to see for those
keys.  I see, for example,

    t_ku <Up>        ^[O*A
    t_kD <Del>       ^[[3~

where ^[ represents Escape.

You might also check the value of 'term'.  I see this:

    :set term?
      term=xterm

I can't think of a cause at the moment, but maybe trying those steps
will shed some light.

Regards,
Gary


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* updated vim broke arrow/delete keys
@ 2016-09-02 15:04 Felipe Vieira
  2016-09-02 16:21 ` Gary Johnson
  0 siblings, 1 reply; 7+ messages in thread
From: Felipe Vieira @ 2016-09-02 15:04 UTC (permalink / raw)
  To: cygwin

Dear all,

I just updated my vim and some keys are now broken.

I'm trying both versions of vim:
vim-7.4.2181-1.tar.xz 07-Aug-2016 21:13 1062348
and
vim-7.4.1990-1.tar.xz                              06-Jul-2016 20:31
          1055584
but both now broke the arrow keys/delete in insert mode.

Up arrow inserts "OA" as text, del inserts "[3~".

How can I fix these and revert to what was before?

I'm assuming my version of vim was even older than those.

Best regards,

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-04 20:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-04 15:19 updated vim broke arrow/delete keys Felipe M. Vieira
2016-09-04 20:48 ` Brian Inglis
  -- strict thread matches above, loose matches on Subject: below --
2016-09-02 21:43 Felipe Vieira
2016-09-02 22:38 ` Erik Soderquist
2016-09-02 23:12 ` Gary Johnson
2016-09-02 15:04 Felipe Vieira
2016-09-02 16:21 ` Gary Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).