I have an absurd problem. Honestly, I have a hard time figuring out whether this belongs here or a Windows forum.

Using Vim on Win10, I've changed my C:\Program Files (x86)\Vim\_vimrc from the awful default that came with the installation to my own. For simplicity's sake, let's say the file was

" _vimrc (default)
colorscheme blue

and I changed it to

" _vimrc (custom)
colorscheme desert

Now, when I run vim in cmd or powershell, the colorscheme is "desert", and :e C:\Program\ Files\ (x86)\Vim\_vimrc opens the custom file as I would expect. But here's where it gets weird: If I try to use the file from any other program (notepad, dir, cat, gvim), it's still the default file, and it's marked as read-only. And when running gvim, it uses the "blue" colorscheme.

My first thought was that vim was working on some temporary file, but the changed file persists over program restarts and even a reboot. Is there two files by the same name? How does Vim load different files than gVim?

The output of :scriptnames has the exact same first line in both Vim and gVim, "C:\Program Files (x86)\Vim\_vimrc".

  • I don't know where you problem comes from and I can't do test on a windows machine right now, but I can say that you shouldn't change the system vimrc, instead you should create one in your home directory (something like C:\User\Gustaphe\_vimrc I believe) that will prevent a lot of troubles related to permissions and this kind of stuff. See :h _vimrc for the places where you can put your vimrc.
    – statox
    May 7 '19 at 8:19
  • That had other complications, mostly related to opaque network setup, but I guess it works out for now. Here's to hoping I can manage to forget the fact that there is a ghost file somewhere on my system...
    – Gustaphe
    May 7 '19 at 9:43
  • Actually that's the right way to go, it's better to debug problem in your user space than in system wide environment.
    – statox
    May 7 '19 at 9:44
  • I wonder if this is related to Windows 32-bit emulation. Depending on whether you're running 32 or 64 bit binary you'll see different contents of some system directories (e.g. \windows\system32). I didn't think the "Program Files" dirs were affected but the behavior you describe smacks of the same thing. Do you see any pattern when comparing behavior of 32-bit programs vs 64-bit? Oh, and you're sure you installed 32-bit Vim (into "Program Files (x86)")?
    – B Layer
    May 7 '19 at 9:52
  • 1
    Just found this question, and the answer there seems to apply here too. I hate Windows sometimes. vi.stackexchange.com/questions/3205/…
    – Gustaphe
    May 7 '19 at 9:54