# How to start Vi in command line in Windows XP?

9 messages
Open this post in threaded view
|
Report Content as Inappropriate

## How to start Vi in command line in Windows XP?

 Dear All, I have installed gVim at my Windows XP computer at C:\Program Files\Vim. I am wondering how I can start vi from cmd window. In another words, how to start vim as command line. Right now, if I just type vi in command, it is not recognized. May be I should set Path. But I don't know what to set. Thank you very much.
Open this post in threaded view
|
Report Content as Inappropriate

## Re: How to start Vi in command line in Windows XP?

 Thank you very much. I just add to PATH the following: C:\Program Files\Vim\vim64. Then in cmd window, no matter which directory I am in, typing "vim.exe" starts vi. One more question: I have to type "vim.exe" to start vim. Is there some way to set so that I only need to type "vi"? Thank you again.
Open this post in threaded view
|
Report Content as Inappropriate

## Re: How to start Vi in command line in Windows XP?

 In reply to this post by Xiaoshen Li-2 Use the System Properties->Advanced->Environment Variables (start at the control panel) to add Vim's executable directory to PATH. Don't change the system ones, but your own in the top part of the environment variables window. Also, you can add a new variable VIM for the executable and/or HOME that will guide Vim as to where to find your _vimrc file. (I'm recounting this from memory, but I'm pretty sure I'm right. I have the following "user" variables: PATH=C:\Documents and Settings\russellb;C:\Program Files\Vim\vim64 VIM=C:\Program Files\Vim\vim64 HOME=C:\Documents and Settings\russellb My _vimrc file is where HOME points. Now, what I've done is overkill, you can probably just add the PATH and get on with life, but I've doctored my environment several times for little reason leaving me confused as to how much I needed to do. Russ Xiaoshen Li wrote: > Dear All, > > I have installed gVim at my Windows XP computer at C:\Program > Files\Vim. I am wondering how I can start vi from cmd window. In > another words, how to start vim as command line. > > Right now, if I just type vi in command, it is not recognized. May be > I should set Path. But I don't know what to set. > > Thank you very much. > > >
Open this post in threaded view
|
Report Content as Inappropriate

## Re: How to start Vi in command line in Windows XP?

 In reply to this post by Xiaoshen Li-2 On Thu, Mar 30, 2006 at 12:28:18PM +0000, Xiaoshen Li wrote: > Dear All, > > I have installed gVim at my Windows XP computer at C:\Program Files\Vim. > I am wondering how I can start vi from cmd window. In another words, how > to start vim as command line. > > Right now, if I just type vi in command, it is not recognized. May be I > should set Path. But I don't know what to set. Note that you're using vim, not vi.  Try type vim and it will probably work.  If not, check your path setting as mentioned in the other reply. James -- GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]> signature.asc (206 bytes) Download Attachment
Open this post in threaded view
|
Report Content as Inappropriate

## Re: How to start Vi in command line in Windows XP?

 In reply to this post by Xiaoshen Li-2 On Thu, 30 Mar 2006, Xiaoshen Li wrote: > Thank you very much. I just add to PATH the following: C:\Program > Files\Vim\vim64. Then in cmd window, no matter which directory I am in, > typing "vim.exe" starts vi. > > One more question: I have to type "vim.exe" to start vim. Is there some way > to set so that I only need to type "vi"? > > Thank you again. Here's are (shuddering) suggestions :) Either one should do it. 1st suggestion -------------- In order to perform an alias in DOS (sorry, I mean CMD), at the prompt, type:    > doskey vi=vim \$* You can place the line above somewhere in My Computer -> Properties -> Advanced -> Environment, I think. I would say C:\autoexec.bat, but I'm getting way ahead of myself. 2nd suggestion -------------- Create a file "C:\Program Files\Vim\vim64\vi.bat" that contains these 2 lines:    @echo off    vim %* That should execute Vim anytime you do "vi". Hope this helps. -- Gerald
Open this post in threaded view
|
Report Content as Inappropriate

## Re: How to start Vi in command line in Windows XP?

 Thank you very much. I did the following and it worked: Create a file "C:\Program Files\Vim\vim64\vi.bat" that contains these 2 lines:   @echo off   vim %* One last question: when I work in Linux computer, I can use "vimdiff one.txt two.txt" to compare the two files. In Windows, is there something similar available with vim? Thank you. Gerald Lai wrote: > On Thu, 30 Mar 2006, Xiaoshen Li wrote: > >> Thank you very much. I just add to PATH the following: C:\Program >> Files\Vim\vim64. Then in cmd window, no matter which directory I am >> in, typing "vim.exe" starts vi. >> >> One more question: I have to type "vim.exe" to start vim. Is there >> some way to set so that I only need to type "vi"? >> >> Thank you again. > > > Here's are (shuddering) suggestions :) Either one should do it. > > 1st suggestion > -------------- > > In order to perform an alias in DOS (sorry, I mean CMD), at the prompt, > type: > >   > doskey vi=vim \$* > > You can place the line above somewhere in My Computer -> Properties -> > Advanced -> > Environment, I think. I would say C:\autoexec.bat, but I'm getting way > ahead of myself. > > 2nd suggestion > -------------- > > Create a file "C:\Program Files\Vim\vim64\vi.bat" that contains these > 2 lines: > >   @echo off >   vim %* > > That should execute Vim anytime you do "vi". > > Hope this helps. > -- > Gerald > -- Xiaoshen Li, PhD Research Assistant Professor The Krasnow Institute for Advanced Study George Mason University tel: (703)993-4407 (O)
Open this post in threaded view
|
Report Content as Inappropriate

## Re: How to start Vi in command line in Windows XP?

 In reply to this post by Gerald Lai-2 >> Thank you very much. I just add to PATH the following: >> C:\Program Files\Vim\vim64. Then in cmd window, no >> matter which directory I am in, typing "vim.exe" starts >> vi. >> >> One more question: I have to type "vim.exe" to start >> vim. Is there some way to set so that I only need to >> type "vi"? In addition to Gerald's good ideas, you can take the lazy route as I've been known to do: c:\> pushd "C:\Program Files\Vim\vim64" c:\Program Files\Vim\vim64> copy vim.exe vi.exe :) It falls down when you try and upgrade, but I also have a bit of a reputation on the list for running [ehem] older versions of Vim.  Folks will be glad to know I'm [finally] no longer running anything less than 6.3 at the moment (well, I might have 6.2 still on an older OpenBSD box, but it's sitting in a closet). -tim
Open this post in threaded view
|
Report Content as Inappropriate

## Re: How to start Vi in command line in Windows XP?

 In reply to this post by Xiaoshen Li-2 > Create a file "C:\Program Files\Vim\vim64\vi.bat" that contains these > 2 lines: > >  @echo off >  vim %* > > One last question: when I work in Linux computer, I can use "vimdiff > one.txt two.txt" to compare the two files. In Windows, is there > something similar available with vim? Thank you. If you don't already have vimdiff.exe in the same folder, you can work around it.  However, IIRC, the vim install comes with vimdiff. If not, however, you can easily either run         vim -d file1.txt file2.txt or you can create a similar batch file as above with, called vimdiff.bat: @echo off vim -d %* -tim