Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] ESC key is delayed in vim/neovim #1680

Closed
niklas88 opened this issue Oct 18, 2018 · 28 comments
Closed

[Windows] ESC key is delayed in vim/neovim #1680

niklas88 opened this issue Oct 18, 2018 · 28 comments

Comments

@niklas88
Copy link

niklas88 commented Oct 18, 2018

First thanks to bringing alacritty to Windows! I'm almost exclusively a Linux user but I sometimes need to use Windows (damn those presentation video dongles). Now with alacritty + WSL Windows becomes an at least somewhat usable OS.

I'm using wsl (via wslbridge from wsltty installation 1.9.3)

In both vim and nvim in insert mode I'm seeing a delay between pressing <ESC> and getting out of insert mode. It feels like almost a second. This doesn't happen with wsltty or the garbage built-in thing they call a terminal.

@meltinglava
Copy link

Think part 2 should be a second issue. Got the same problem with norwegian layout.

@niklas88 niklas88 changed the title [Windows] Problems with keyboard input [Windows] ESC key is delayed in vim/neovim via wslbridge Oct 18, 2018
@niklas88
Copy link
Author

@meltinglava I've changed the title and created a new issue (#1681).

@Bobo1239
Copy link

Have you tried this already? https://www.johnhawthorn.com/2012/09/vi-escape-delays/

@niklas88
Copy link
Author

@Bobo1239 I had not until just now. I wasn't using tmux for which I knew about that setting and had it set. Setting the timeouts in vim and zsh sadly had no effect.

@zacps
Copy link
Contributor

zacps commented Oct 19, 2018

My initial suspicion is that it's caused by this.

I must say I don't know a lot about terminal escapes, @chrisduerr is there a way to explicitly send just the escape key without it being potentially recognised as an escape sequence?

Otherwise we could reduce that timeout, though that would require changes to the winpty-agent binary, so would have to be changed on winpty's repo.

@chrisduerr
Copy link
Member

I'm not aware of any way to send escape other than sending escape.

However vim does have a built-in alternative to <Esc> which is <C-[>. Have you tried that?

@zacps
Copy link
Contributor

zacps commented Oct 19, 2018

ctrl-c also does (almost) the same thing, and is instant. It's definitely an issue with the escape sequence delay.

If there's no way to 'flush' the input processing in winpty then changing the timeout seems reasonable. This doesn't happen in all terminals using winpty though, I'll take a look at how they handle it.

@zacps zacps changed the title [Windows] ESC key is delayed in vim/neovim via wslbridge [Windows] ESC key is delayed in vim/neovim Dec 20, 2018
@zacps
Copy link
Contributor

zacps commented Dec 20, 2018

Changed title because this is caused by winpty, not wslbridge.

@strega-nil
Copy link

@chrisduerr it does still happen with <ctl-[>

@zacps
Copy link
Contributor

zacps commented Jan 1, 2019

@niklas88
Copy link
Author

niklas88 commented Jan 9, 2019

I can no longer reproduce this with the newest Alacritty version on Windows, at least not when using ConPTY. Vim and NeoVim work fine both via ssh and on local WSL.

@chrisduerr
Copy link
Member

Great to hear this is resolved by ConPTY, though this issue has already been flagged by @zacps as WinPTY, so he's probably already aware.

@BatmanAoD
Copy link

I'm seeing this issue even in vi-mode readline, with Git Bash. It takes about one second to register the escape key.

I have not yet tried installing any additional software.

@xarthurx
Copy link

Same issue here. Need to wait around 1s for ESC or C-[.

@jayceekay
Copy link

i'm also experiencing this

@seantalts
Copy link

Does anyone have a fix for this? i.e. how can get alacritty to use ConPTY?

@chrisduerr
Copy link
Member

If you are up to date with Windows, you just need to set the conpty setting in the config (see default config for docs).

@BatmanAoD
Copy link

@chrisduerr Hadn't seen that because my .yml file is apparently from an older version. Thank you!

For anyone else who doesn't have the option in their .yml yet:

enable_experimental_conpty_backend: false

@jamessewell
Copy link

This still doesn't work for me with
enable_experimental_conpty_backend: true

@chrisduerr
Copy link
Member

@jamessewell Make sure you're using at least version 1809 of Windows 10. Previously the ConPTY interface was not supported yet.

@jamessewell
Copy link

jamessewell commented Apr 10, 2019 via email

@chrispitude
Copy link

I also found that (1) upgrading to Windows 10 build 1809 and (2) enabling the experimental conpty backend resolved the vim ESC key delay.

@Peaches491
Copy link

For everyone else with the same escape delay problem, I made this simple script to help debug:
https://gist.github.com/Peaches491/e0017ce55699a485b776107efc87ec21

Run that, and you should see 27 printed out when you hit ESC. Hopefully you see it right away, with no delay.

For me, updating to Window 10 Build 1903, and enabling enable_experimental_conpty_backend fixed the delay 👍

@neel-bp
Copy link

neel-bp commented Aug 14, 2019

it seems like after pressing "esc" its waiting for something and goes in a timeout for it, if i immediately press colon key after "esc" it some weird character comes out and when i tried the same thing with other keys some other characters were coming out these are some of it:
»ºñ´åòôùçæäöãøö
but when leaving insert mode with Ctrl-C, vim goes to normal mode like usual.

@BatmanAoD
Copy link

BatmanAoD commented Aug 14, 2019 via email

@jamessewell
Copy link

jamessewell commented Feb 20, 2020

Strangely this has regressed with an updated alacritty and new Laptop on Win 10 1903

Script above shows delay when pushing escape

EDIT: The problem was tmux this time! Pretty sure set -s escape-time 0 in .tmux.conf fixed it

@chrisduerr
Copy link
Member

WinPTY support has been removed.

@zacharytyhacz
Copy link

Strangely this has regressed with an updated alacritty and new Laptop on Win 10 1903

Script above shows delay when pushing escape

EDIT: The problem was tmux this time! Pretty sure set -s escape-time 0 in .tmux.conf fixed it

Ultimate bruh moment, come on tmux. Thank you for the fix

bhalash added a commit to bhalash/dotfiles that referenced this issue Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests