How do you run Vim in Windows?
When you install gVim
:
Please make sure [✓] Create .bat files for command line use is checked.
It'll create several .bat
files in C:\Windows\
:
C:\>cd %windir%C:\WINDOWS>dir /b *.batevim.batgview.batgvim.batgvimdiff.batview.batvim.batvimdiff.batvimtutor.bat
Notice that: C:\WINDOWS
is already in the PATH
environment variable.
When you type vim
in command line, C:\WINDOWS\vim.bat
will be launched.
If you leave the checkbox mentioned above unchecked, you need to modify PATH
manually.
Just to supplement, I'm on a fairly highly controlled Windows workstation right now, and don't have access to much. Downloading the "executable installer" that I usually use did not create the bat
files nor, for some reason, vim.exe
, though gvim.exe
was installed in the vim74
dir for me and worked fine. So though I also needed to set the PATH
, that there was no bat
file in C:\WiNDOWS
nor any command line executable in my VIm runtime folder to call meant that callingvim
from the command line (or Powershell) didn't work.
I'm guessing some portion of the install that's creating the command-line related stuff, apparently including vim.exe
, isn't recovering gracefully when you don't have admin permissions.
Either way, the "right" thing to do appears to be to set your PATH
to your vim executable folder as usual (note that this might be a little more difficult than usual if you don't have admin privs), then download the "Win32 console executable" from the usual download page that matches the version of gvim
that you've already installed, dig vim.exe
out of that zip you just downloaded, and place that into the same folder as gvim.exe
.
Looking on another box where the executable installer did work "fully", there's some jive in the vim.bat file that wasn't installed for me about "collect the arguments in VIMARGS for Win95" and if .%OS%==.Windows_NT goto ntaction
, etc etc, but not having any of that doesn't seem to be a problem on Win7, at least. ;^)