33

On several new CentOS 7 machines, I find that VIM automatically starts in replace mode.

After removing all automatically installed .vimrc files, normal behavior returns. However, if I simply create a .vimrc (eg. touch ~/.vimrc), VIM will begin starting with replace mode enabled by default…

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Michael
  • 601
  • 1
  • 5
  • 7

2 Answers2

31

Seems to be an issue with utf-8 ambiguous characters and Windows cmd console. Flag t_u7 is set by default and so vim will request cursor position and get a bad reply from the ssh client.

Workaround: Adding set t_u7= or set ambw=double to your vimrc should fix the problem. set t_u7= will disable requesting cursor position and ambw=double will set the ambiguous characters mode to double.

For more info see vim reference manual: https://vimhelp.org/term.txt.html

Zoran Bikicki
  • 411
  • 4
  • 2
  • 3
    `set ambw=double` appears to have conflict with airline/powerline characters. I see extra spaces after the <| arrows. `set t_u7=` works though! – David Woods Jul 09 '20 at 17:12
  • 4
    I'm using Windows Terminal 1.2.2381 with Ubuntu 20.04.1 in WSL 1. This problem seemed to start spontaneously recently - perhaps something auto updated recently. Anyway, this fix resolved the problem. – Bill Hoag Sep 03 '20 at 12:58
  • 1
    As another commented mentioned, I am seeing this in Ubuntu 22.04.2 LTS in WSL 1. – FriskySaga Apr 01 '23 at 03:44
17

I have just identified that the issue only occurs when connecting to the remote system using the native OpenSSH client released with Windows 10 1709 using the ConEmu terminal emulator. If I use the same client with native powershell or cmd there is no difficulty - appears to be an issue with ConEmu. Hopefully this helps someone else.

Michael
  • 601
  • 1
  • 5
  • 7
  • 1
    Strangely enough I'm getting this behaviour on Windows 10 1709 using native cmd & /windows/system32/openssh/ssh client. I don't think I have ConEmu installed. – jevon Nov 19 '18 at 23:03
  • 1
    I am also seeing this when using the OpenSSH client available through Windows 10. I have ConEmu installed and see it there. But I also see it in standard PowerShell windows and the new Windows Terminal preview. It is unbelievably aggravating. – jdgregson Aug 13 '19 at 15:48
  • 2
    I was getting the same thing on Windows 10 1809 using the built-in SSH client to talk to a Synology NAS box running some flavour of Linux. Following the suggestion in [John Bolding's answer](https://stackoverflow.com/a/54464885/2096401) to a similar question, setting `TERM=screen-256color-s` seems to have worked (so far...!). – TripeHound Jan 28 '20 at 10:56