Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using windows 7.

Unix I can open a file in vi with by using:

vi textFile.txt

In windows I want to navigate to the folder and type what I have above.

What is the best way to go about this?

Thanks, Eric

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Firstly vi isn't installed by default and is not available on windows. A very good emulation of vi is available called vim, I assume for the rest of this that you have vim installed.

What you want to do is launch vim.exe from the command line without specifying the full path to the file. To do that you need to add the full path to the file's containing folder to the PATH environment variable. Here's how to do that:

Go to computer in windows explorer. Then right click on the background and select properties This should bring you to the system folder of the control panel.

In the left hand pane click Advanced system settings, click the environment variables button at the bottom of the new window that pops up.

The top pane of this window should be titled User variables for <Your Username>. Scroll through this list of user variables, and find one named path (capitalisation not important) and edit it. If there isn't a path variable on the list, then click the new button under the list to create a new variable, and name it path.

If you're creating a new path variable, simply paste the path to the containing folder as the value of the user variable. if you're editing an existing path variable you need to add a semi-colon ; character immediately followed by the path to your vim installation. the path to your vim instalation proably looks something like this: C:\Program Files (x86)\Vim\vim74

Now you should be able to use vim similarly to how you would use vi.

share|improve this answer

On my system it works, the syntax is the same:

C:\>vim somefile.txt

Make sure vim is in your path. Make sure you select the console and GUI versions when installing (I think this is the default now).

share|improve this answer
    
What needs to be in my path for windows? Vim.exe? –  eric f Aug 31 '12 at 12:20

During Vim (for Win32) install, you have the option to install batch files for launching vim from the command-line.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.