startupwindows-subsystem-for-linuxvi

Why VI always starts in insert mode?


At some point, whenever I use vi from the command line (windows 10/WSL) it starts up in insert mode, meaning that everything I usually do to navigate ends up adding stuff to the file, wasting time having to clean it up.

I didn't have a vimrc file, and there doesn't seem to be anything in my bash rc files to modify vi behavior. Any ideas what I may have done or any ideas how to stop this behavior? I'm using Ubuntu-20.04

FWIW, adding a .vimrc file with tab related settings didn't change it's behavior. I looked at the /etc/vimrc file, and nothing inside it seemed relevant.


Solution

  • After plowing through google search and trying everything I understand about configuring 'vim' and doing comparison tests, I think:

    1. This behavior is specific to Windows Terminal when opening a WSL terminal. Using WSL's "native" terminal (i.e., clicking the "Ubuntu 20.04 LTS" menu in the "Start" menu) doesn't have this problem.
    2. My original motivation for switching to Windows Terminal is for its multi-tab feature. But this new behavior is crazy -- it works against years of my muscle memory of using "vi", and I'm almost certain that one day I'll accidentally update some configuration file while reading it in "vi". And, I cannot re-train a new muscle memory because all the rest of the UNIX world (e.g., when I SSH into a remote server) hasn't changed. This is like constantly switching between a Mac keyboard and a PC keyboard where the Ctrl key, etc., are in different places.

    My solution: I switched to MobaXterm. It has multi-tab support, and is actually richer in features compared to Windows Terminal.