Reputation: 365
I am trying to set up a development environment on Windows 10. So far I've installed Vim and Cmder (the full version with Git for Windows).
Playing around, I noticed some strange behavior which I don't understand, but I feel like it is important that I understand.
Case A
vim.exe
.\vim.exe
:version
to check the version number and to see where my _vimrc
file is locatedCase B
I open Cmder and open a new PowerShell tab (I am assuming that that gives me access to the PowerShell instead of the default cmd.exe, but please correct me if I am wrong.)
NOW THIS IS WHERE IT GETS INTERESTING If I repeat steps 2-6 exactly as in Case A, I get exactly the same result.
BUT:
If instead of locating the folder that stores vim.exe
I just type in vim
and hit Enter
it opens Vim once again, but this time it has a tab on the bottom that says "unix". See attached images.
Out of curiosity, in Normal Mode I type :version
, just like in Case A, but this time I am getting a different date in the version section, a different selection of options, and a different Unix-like path to the vimrc file which in now .vimrc
instead of _vimrc
.
What gives? My guess is that Git for Windows that came with Cmder is simulating a Unix environment and accessing a different Vim version that was compiled for Unix?
If this is true, then could you help me make sense of this Windows/Unix environment duality? Do I now have two HOME folders, two copies of the vimrc file, and two copies of who knows what else? What is simulating this Unix environment - Cmder?
Thanks!
Upvotes: 1
Views: 603
Reputation: 313
I don't have experience with Cmder, but I use Git for Windows a lot. Git for Windows comes with some Unix utilities and uses Cygwin which is Unix emulator for running those. Vim is among them as default text editor for commit messages, etc. So it might be it.
I tried to reproduce this on my machine. but I cannot reproduce what you are seeing. Nonetheless I found the vimrc file for the Vim you are probably using in the second case.
It is in <Cmder-dir>\vendor\git-for-windows\etc\vimrc
.
Upvotes: 1
Reputation: 172768
You have two different versions of Vim installed, and depending on the environment you start it from, one or the other gets selected. Git (as a tool that initially was developed on and for Linux) typically brings with it a set of Windows-ports.
You can check what Vim binary is used (respectively) from within Vim via
:echo v:progpath
Whether you live with this duplication or try to consistently use one Vim instance is up to you. It looks like the Vim that accompanies Git has more Unix-centric settings; it might be good to keep that to avoid interoperability issues.
You definitely don't need to clone your whole Vim configuration - as long as you stick to Unix-style (LF) line endings, it can be understood by any Vim. By setting the HOME
environment variable (but that may affect other programs!), you can make Vim use the same location. Else, you could give one Vim config location a small .vimrc
that just corrects 'runtimepath'
, and then :source
s the "real" vimrc from the other location.
Upvotes: 0