I just installed gVim, and tried using the usual "vim myfile.java" technique that usually works for linux to open up a file and edit it. But unfortunately, this doesn't seem to work. I've also tried "gvim myfile.java", but that doesn't work either.
Does anyone know how to open up vim (and use it like you do in linux) using Windows Powershell, or some other technique?
To move from the current Vim window to the next one, type CTRL-W j (or CTRL-W <down> or CTRL-W CTRL-J). The CTRL-W is the mnemonic for “window” command, and the j is analogous to Vim's j command, which moves the cursor to the next line.
vim is a text editor that is upwards compatible to Vi. There are a lot of enhancements above Vi: multi level undo, multiple windows and buffers, syntax highlighting, command line editing, file name completion, a complete help system, visual selection, and others.
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 *.bat evim.bat gview.bat gvim.bat gvimdiff.bat view.bat vim.bat vimdiff.bat vimtutor.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. ;^)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With