Starting vim from Windows PowerShell
23,089
Solution 1
There's probably a file called vim.
that appears in the Path before vim.exe
(or it's in the local folder you're trying to launch vim
from) so it's getting called first when you type vim
.
Solution 2
create alias for vim
Set-Alias vim ' C:\Program Files (x86)\Vim\vim74\gvim.exe'
Set-Alias vi ' C:\Program Files (x86)\Vim\vim74\gvim.exe'
you can change the path if installed in different directory.
Author by
Bryan
Updated on September 18, 2022Comments
-
Bryan over 1 year
This isn't necessarily a problem, I'm more curious why this behavior occurs.
When attempting to launch vim from powershell, I'm greeted with the
Open with
window:PS C:\> vim
If I specify:
PS C:\> vim.exe
Vim launches as expected. gVim launches as expected no matter if I specify:
PS C:\> gvim.exe
or
PS C:\> gvim
Again, it's not really problem, I just want to know why it happens and what I should look into to get consistent behavior when launching both vim and gvim from powershell.
-
Bryan over 10 yearsThat was it, thanks! The file was created as part of the Git install for Windows:
C:\Program Files (x86)\Git\bin\vim
. There are other similar files for various GNU tools that exhibit the same behavior. -
Bryan over 10 years
gvim
is a different application thanvim
andvi
. There are times when I want to edit in a separate window, and times when I'd like to edit in the command window. -
GC 13 over 10 yearsyes @beargle, you are right with the console vim and the graphical vim (gvim) I would like to recommend the console vi editor [1] (ftp.vim.org/pub/vim/pc/vim74w32.zip) Later you can set alias to the executable of that. Yes you can run it on your console window. :)