vim under wsl through openssh opens with "1c" in normal mode #16395

Closed
opened 2026-01-31 05:06:19 +00:00 by claunia · 9 comments
Owner

Originally created by @simon-weber on GitHub (Jan 14, 2022).

Windows Terminal version

1.11.3471.0

Windows build number

10.0.19043.1466]

Other Software

vim 8.1: Included patches: 1-2269

Steps to reproduce

  • ssh from a client running wsl2 ubuntu to a server also running wsl2, connecting through windows openssh.
  • open a file with vim

Expected Behavior

No characters should be entered in normal mode.

Actual Behavior

The characters "1c" are pre-entered, which mess with the first command. Hitting escape to clear the commands works fine, and vim works normally afterwards (as far as I can tell).

Some notes:

  • there's a lot of other software involved here, but since https://github.com/microsoft/terminal/issues/1637 seemed similar I figured I'd open an issue here
  • clearing out ~/.vimrc and /etc/vim/vimrc has no effect
  • running vim -u none somefile does prevent the issue. :scriptnames shows about two dozen built-in scripts under /usr/share/vim/vim81/ being the difference, but disabling them all by renaming doesn't affect anything, oddly.
  • the problem does not occur on the host or client machines alone (vim under wsl); it requires sshing
Originally created by @simon-weber on GitHub (Jan 14, 2022). ### Windows Terminal version 1.11.3471.0 ### Windows build number 10.0.19043.1466] ### Other Software vim 8.1: Included patches: 1-2269 ### Steps to reproduce * ssh from a client running wsl2 ubuntu to a server also running wsl2, connecting through windows openssh. * open a file with vim ### Expected Behavior No characters should be entered in normal mode. ### Actual Behavior The characters "1c" are pre-entered, which mess with the first command. Hitting escape to clear the commands works fine, and vim works normally afterwards (as far as I can tell). Some notes: * there's a lot of other software involved here, but since https://github.com/microsoft/terminal/issues/1637 seemed similar I figured I'd open an issue here * clearing out ~/.vimrc and /etc/vim/vimrc has no effect * running `vim -u none somefile` _does_ prevent the issue. `:scriptnames` shows about two dozen built-in scripts under `/usr/share/vim/vim81/` being the difference, but disabling them all by renaming doesn't affect anything, oddly. * the problem does not occur on the host or client machines alone (vim under wsl); it requires sshing
claunia added the Resolution-Duplicate label 2026-01-31 05:06:19 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jan 18, 2022):

Which version of ssh.exe? I suspect this belongs over at https://github.com/PowerShell/Win32-OpenSSH/issues

@zadjii-msft commented on GitHub (Jan 18, 2022): Which version of `ssh.exe`? I suspect this belongs over at https://github.com/PowerShell/Win32-OpenSSH/issues
Author
Owner

@ghost commented on GitHub (Jan 22, 2022):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Jan 22, 2022): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@simon-weber commented on GitHub (Jan 22, 2022):

ssh -V in a server windows cmd gives OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2.

I tried a few more things and I'm more confident it has to do with terminal now:

  • no problem when connecting via ssh from a linux host
  • no problem when connecting via ssh under wsl in cmd; problem occurs when swapping in terminal
@simon-weber commented on GitHub (Jan 22, 2022): `ssh -V` in a server windows cmd gives `OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2`. I tried a few more things and I'm more confident it has to do with terminal now: * no problem when connecting via ssh from a linux host * no problem when connecting via ssh under wsl in cmd; problem occurs when swapping in terminal
Author
Owner

@zadjii-msft commented on GitHub (Jan 25, 2022):

Can you try updating to the latest ssh.exe? https://github.com/PowerShell/openssh-portable/releases/tag/v8.6.0.0 might fix this

@zadjii-msft commented on GitHub (Jan 25, 2022): Can you try updating to the latest `ssh.exe`? https://github.com/PowerShell/openssh-portable/releases/tag/v8.6.0.0 might fix this
Author
Owner

@simon-weber commented on GitHub (Jan 26, 2022):

I've upgraded to ssh 8.6p1 using these instructions, but it doesn't seem to have made a difference.

@simon-weber commented on GitHub (Jan 26, 2022): I've upgraded to ssh 8.6p1 using [these instructions](https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH), but it doesn't seem to have made a difference.
Author
Owner

@arfycat commented on GitHub (May 19, 2022):

I've been experiencing this issue as well for months (likely more than a year) now on what I'll call Server A. Similar workflow though different versions. The only workarounds I've figured out are changing TERM (or using -T), hoping for compatibility. Some notable values, though not fully tested for behavior:

  • vt100: no color but otherwise seems to work properly. Bold does work which I suppose is better than nothing.
  • ansi: color, enters replace mode, but no further extra characters. A bit better behavior than the xterm- options as at least I don't need to remember to delete the extra characters or undo.
  • pcansi: Doesn't enter replace mode, no extra characters, and color! Unfortunately inputs don't work properly.

I have also noticed that when running vim when PuTTYing instead of Windows Terminal + ssh, vim will enter replace mode but no extra characters. User environment appears exactly the same though, in particular TERM=xterm-256color

On a different Windows host (Server B), I get different behavior. It does not ever enter replace mode or have extra inputs on vim start. Some time ago, it did have the same behavior as the other server though. I don't know what fixed the problem, whether it was the upgrade to Windows 11 or something else. Unfortunately, I don't ssh in and run vim every day so I couldn't determine what changed.

Client, a Windows laptop:

  • Windows 11 10.0.22000.675
  • Windows Terminal Preview 1.13.10984.0 (same behavior with Windows Terminal 1.12.10983.0)
  • OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

Server A, a VM running under FreeBSD bhyve:

  • Windows 10 10.0.19044.1706
  • OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
  • WSL 1
  • Ubuntu 21.10, fully updated
  • VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 17 2021 16:55:33), Included patches: 1-2434, 3402-3403, 3409, 3428, 3487, 3564, 3581-3582, 3611, 3613, 3612, 3625, 3669, 3741

Server B, a Windows desktop:

  • Windows 11 10.0.22000.675
  • OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
  • WSL 1
  • Ubuntu 21.10, fully updated
  • VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 17 2021 16:55:33), Included patches: 1-2434, 3402-3403, 3409, 3428, 3487, 3564, 3581-3582, 3611, 3613, 3612, 3625, 3669, 3741
@arfycat commented on GitHub (May 19, 2022): I've been experiencing this issue as well for months (likely more than a year) now on what I'll call _Server A_. Similar workflow though different versions. The only workarounds I've figured out are changing TERM (or using -T), hoping for compatibility. Some notable values, though not fully tested for behavior: - `vt100`: no color but otherwise seems to work properly. Bold does work which I suppose is better than nothing. - `ansi`: color, enters replace mode, but no further extra characters. A bit better behavior than the xterm- options as at least I don't need to remember to delete the extra characters or undo. - `pcansi`: Doesn't enter replace mode, no extra characters, and color! Unfortunately inputs don't work properly. I have also noticed that when running vim when PuTTYing instead of Windows Terminal + ssh, vim will enter replace mode but no extra characters. User environment appears exactly the same though, in particular `TERM=xterm-256color` On a different Windows host (_Server B_), I get different behavior. It does not ever enter replace mode or have extra inputs on vim start. Some time ago, it did have the same behavior as the other server though. I don't know what fixed the problem, whether it was the upgrade to Windows 11 or something else. Unfortunately, I don't ssh in and run vim every day so I couldn't determine what changed. Client, a Windows laptop: - Windows 11 10.0.22000.675 - Windows Terminal Preview 1.13.10984.0 (same behavior with Windows Terminal 1.12.10983.0) - OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2 Server A, a VM running under FreeBSD bhyve: - Windows 10 10.0.19044.1706 - OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2 - WSL 1 - Ubuntu 21.10, fully updated - VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 17 2021 16:55:33), Included patches: 1-2434, 3402-3403, 3409, 3428, 3487, 3564, 3581-3582, 3611, 3613, 3612, 3625, 3669, 3741 Server B, a Windows desktop: - Windows 11 10.0.22000.675 - OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2 - WSL 1 - Ubuntu 21.10, fully updated - VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 17 2021 16:55:33), Included patches: 1-2434, 3402-3403, 3409, 3428, 3487, 3564, 3581-3582, 3611, 3613, 3612, 3625, 3669, 3741
Author
Owner

@fireflyoo commented on GitHub (Feb 10, 2023):

I also have this issue..it troubled me..
I don't know how to resolve it..
Only way to avoid this issue is switch to cmd..or other terminal

@fireflyoo commented on GitHub (Feb 10, 2023): I also have this issue..it troubled me.. I don't know how to resolve it.. Only way to avoid this issue is switch to cmd..or other terminal
Author
Owner

@carlos-zamora commented on GitHub (Apr 5, 2023):

I'm going to mark this as a /dup of #1637. It's fixed in Windows 11.

@carlos-zamora commented on GitHub (Apr 5, 2023): I'm going to mark this as a /dup of #1637. It's fixed in Windows 11.
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Apr 5, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Apr 5, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16395