0

I'm using gVim 9.0 on Windows. Here is the steps to reproduce the issue:

  1. Open a vim-terminal with :term.
  2. Open a vim inside the vim-terminal using command C:\Windows\vim.bat in vim-terminal.
  3. Enter insert mode and type something more than 5 chars (such as abcdefg).
  4. Return normal mode with Esc, and move cursor to column 3 (position of c).
  5. Press i to enter insert mode.
  6. Press Esc to exit insert mode. <-- issue appears

The Esc in step 4 is totally fine, but when I type Esc in the last step, in about 1 second it won't exit insert mode but acts like I'm pressing Alt. For example, it will print a á if I type Esc and then a, as if I pressed Alt + a. And this vim-terminal is like corrupted: I have to exit the vim-terminal and start another fresh one with :term to make this issue stop.

I've tried to set timeout, set timeoutlen=1, set ttimeout and set ttimeoutlen=1, but it doesn't help.

Is there anyway to resolve this issue?

4
  • What is the value of the ttimeoutlen setting (note the two ts)? The way Alt keymappings work is that the terminal sends <Esc> followed by the key (so <A-x> is <Esc>x); Vim will wait ttimeoutlen milliseconds for the second key (if this value is -1, the value of timeoutlen is used, which defaults to 1000, or 1 second). Usually you can set ttimeoutlen to something fairly short like 100 or 50; the only value for long timeouts is slow SSH connections and the like. Jul 5, 2022 at 15:56
  • Also see: vi.stackexchange.com/a/24938/51 Jul 5, 2022 at 15:56
  • @MartinTournoij Thank you for this. I checked and my situation is nottimeout and ttimeout=-1. I’ve tried to set ttimeout to 1, and set ttimeout as well as set ttimeout=1, both in gVim and in the vim inside gvim-terminal, but no avail. However, I’ve found a workaround: use Ctrl + [ for Esc, hehe.
    – lzhh
    Jul 6, 2022 at 14:37
  • @MartinTournoij Ctri+[ works exactly the same with Esc : ( I found more details about this issue and updated question. Could you review it and see if there is any new idea, if it's not inconvenient for you?
    – lzhh
    Jul 7, 2022 at 4:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.