WSL icon indicating copy to clipboard operation
WSL copied to clipboard

VIM over SSH starts in REPLACE

Open PathosV opened this issue 7 years ago • 6 comments

  • Your Windows build number: Microsoft Windows [Version 10.0.18362.295]

  • WSL : Ubuntu 18.04.3 LTS

  • What you're doing and what's happening:

I am connecting to a work cluster and editing files with vim. Using the openssh packaged with Ubuntu, vim will start in REPLACE mode when opening a file on the connected server. Editing files on local machine does not cause this problem.
Using the openssh provided by Windows gives the same results. Using the openssh provided by Git-Bash fixes the issue, but is not an optimal solution for use with my .ssh/config due to the file path.

I've also connected to an AWS server and did not experience this issue with the built-in ssh, so it is not completely broken for me. My hunch is that it might have to do with the server requiring diffie-hellman-group1-sha1.

More Info:

Work Cluster: SUSE Linux Enterprise Server 12 SP3

/usr/bin/ssh
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017

/mnt/c/WINDOWS/System32/OpenSSH/ssh.exe OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

/mnt/c/Program\ Files/Git/usr/bin/ssh.exe OpenSSH_8.0p1, OpenSSL 1.1.1c 28 May 2019 (works in both WSL and Windows Environments)

Issue is independent of Terminal's tested:

  • MINGW64
  • cmd
  • Powershell
  • Windows Terminal

Related (Reverse) Issue: https://github.com/microsoft/terminal/issues/1637

PathosV avatar Sep 03 '19 04:09 PathosV

I am not sure how a change in the encryption method used in the SSH would affect the starting settings on vim.

Because you can reproduce with other platforms leads me to think this is a setting in vim on your server. Have you ruled that out?

sirredbeard avatar Sep 09 '19 17:09 sirredbeard

I had previously checked my personal vimrc settings and found nothing that fixed the issue. I only just found the -u option for vim to load only a specific file, so I checked each setting in /etc/vimrc and found a lead.

The guilty setting:

set esckeys  " Required to be able to use keypad keys and map missed escape sequences

The "fix" :

set noesckeys

Only works if placed after:

set nocompatible

This is still not a preferable "fix". Loading the server setting file on my local machine also does not cause an issue. No issue on my AWS server either. Seems like vim is receiving some escape codes over ssh that are again specific to my work cluster.

PathosV avatar Sep 10 '19 05:09 PathosV

To be clear, my last comment was not an indication that my problem is solved. While the problem does have something to do with the unique connection to my work cluster, it only occurs when using the Windows or WSL versions of openSSH.

PathosV avatar Sep 21 '19 14:09 PathosV

Your OP question is not WSL actionable. Neither vim not ssh ship as part of WSL, and WSL is not related to your AWS server. There is no CLI reproduction identifying a WSL1 diverge in the Linux syscall surface.

Questions are left open for a while to give the community a chance to weigh in with help on this WSL repo, based on community interest (me2s) and the likelihood it will lead to identifying a WSL diverge. You may find more more eyeballs at a Ubuntu forum or at Superuser. If you manage to identify a WSL1 kernel diverge please feel encouraged to open a new issue following the issue template, which reads in part:

Please use the following bug reporting template to help produce issues which are actionable and reproducible, including all command-line steps necessary to induce the failure condition. Please fill out all the fields! Issues with missing or incomplete issue templates will be closed.

therealkenc avatar Sep 21 '19 16:09 therealkenc

I fixed this problem by 'set TERM=xterm-color'(not 256color) before using ssh (Windows OpenSSH version).

ioklo avatar Apr 26 '20 05:04 ioklo

Win10 (2004 19041.388) -> wezterm-tab/hyperjs/mintty -> pwsh-core (7.0.2) -> sshclient (OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5) -> Virtualbox (6.1.12) -> Fedora-32 -> openssh-server (8.3p1-3) -> bash-shell (5.017) -> vim (8.2.1081) Starts in replace mode as often as one in 3 attempts.

Instead of using the default OS-bundled ssh-client

> C:\WINDOWS\System32\OpenSSH\ssh.exe -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 

I updated an instance of a local windows openssh server, to a pre-release version 8.1. The ssh-server also comes with its own ssh-client.

> 'C:\Program Files\OpenSSH-Win64\ssh' -V
OpenSSH_for_Windows_8.1p1, LibreSSL 2.9.2 

probably, the bug still exists, but is less frequently encountered

hgkamath avatar Jul 19 '20 14:07 hgkamath