I'm using gVim 9.0 on Windows. Here is the steps to reproduce the issue:
- Open a vim-terminal with
:term
. - Open a vim inside the vim-terminal using command
C:\Windows\vim.bat
in vim-terminal. - Enter insert mode and type something more than 5 chars (such as
abcdefg
). - Return normal mode with Esc, and move cursor to column 3 (position of
c
). - Press i to enter insert mode.
- 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?
ttimeoutlen
setting (note the twot
s)? The way Alt keymappings work is that the terminal sends<Esc>
followed by the key (so<A-x>
is<Esc>x
); Vim will waitttimeoutlen
milliseconds for the second key (if this value is -1, the value oftimeoutlen
is used, which defaults to 1000, or 1 second). Usually you can setttimeoutlen
to something fairly short like100
or50
; the only value for long timeouts is slow SSH connections and the like.nottimeout
andttimeout=-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: useCtrl
+[
for Esc, hehe.Ctri
+[
works exactly the same withEsc
: ( 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?