(new versions of linux will open up VIM when you enter VI..which is what we'll be dealing with here)

A win32 version is available Here.

linux help and man files are very informative...but not very helpful if you're new to linux. when i read the vim man file for the first time i could swear i saw things like..."to capitolize the second letter of the forth word in every third line spin your chair around three time then punch the keyboard". so for the longest time i would just install joe or pico

below is all you really need to know to use VI/VIM to view/edit ascii files. of course once you've learned to use it there are many more commands and options that will help you use it well. VIM It is a very powerful tool but being as this is for 'basic survival' we will not be dealling with the advanced stuff.

Viewing/Editing files:

if you want to view the contents of a file using vim simply type 'vi filenane' at the prompt. filename being the name of the file you wish to open. If the file is in a directory other than the one you are in the path must be included with the file name. You are now in 'VIEW' mode and no changes can be made.

if you wish to edit this file you'll need to enter 'insert mode' by hitting the 'insert' key on the keyboard. you wll see --INSERT-- appear at the bottom left on your screen. you can now make all the changes you need. use the cursor (arrow) keys on the keyboard to navigate to where you want to make the changes in the document and simply type, delete, whatever.

when you've finished viewing and/or editing you need to return to view mode...this is done by pressing the 'Esc' key. you'll notice --INSERT-- will be gone.

Quitting VI:

if no changes have been made            :q and press enter 

to save changes                         :wq and press enter

quit and not save                       :qa! and press enter
so if you find yourself typing in a file you didn't want to be typing in simply enter :qa! and no harm will have been done

NOTE: the ':' must be typed along with the letter/s of the command

Creating Files:

The easiest way to creat a new file is simply add the name you want to give the new file as an argument to vi (vi newfilename), enter insert mode, put what you want into the file, switch to view mode (Esc) then save the changes (:wq). a simple ls will show newfile listed there and a 'cat' will show the text you added are in that file.

you can also create a new file by just opening vim, entering insert mode, put in what you want, return to view mode (Esc) then put the name you want to give this file after the write/quit command (:wq newfile).

there is one more feature id like to cover. although its a little beyond survival it can make life allot easier.

if your need to change one string a long .conf or script... while in view mode type the string preceeded by a foward slash (/somestring). as you are typing you'll notice the letters typed are being highlighted at the first location that contains them all. when you get to the full string where you want to make the change, hit enter to be in insert mode at the spot. make your changes then write and quit.

To get help while in insert mode hit <F1>, while in view mode use either F1 or enter :h

ok! let's do a quick exercise.

at the prompt enter 'vi test' (without the quotes). Now hit Insert and type 'this is not a test'. get out of insert mode by pressing 'Esc' the save and quit by entering ':wq' (no quotes...anywhere)

you should be back at the prompt.

now again type vi test. you'll find the text you typed earlier has indeed been saved in the file called test that you created.

now type '/not' hit enter then hit insert. hit del three times then type 'just'. press 'Esc' to leave insert mode, save the changes and exit

a quick 'cat test' should show you your changed sentence.

congrats! your now a vi user. well not a very advanced one but a user just the sam and we got to start somewhere.