(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.
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.
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
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
NOTE: the ':' must be typed along with the letter/s of the command
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.
nice write up... But, not really up to your own personal standards of excellence... Nice none-the-less... I wish you would of explained more about Vi and vim, but it's a decent beginner work...
You went way easier on him than you did me.
This is his first **** up... You continually **** up... and then **** up again after we tell you we don't want anymore damn tutorials on installing a distro...
He just messed up this once with short info...
Hm.. I think I am going to write another tutorial sometime soon...
Sorry whizkid2300 and gore. i wrote what i wish would have found when i was trying to use vi. i didn't do it to up my tut count or anything but if you think AO deserves more then ill get after it and add more to it...in the orginal post if its not closed for editing or as a reply if it is...thanks!
Here's a vi cheatsheet that I made a while back for one of my Linux classes.. I rather like it.. I've attached it to threads in the past, but since this one is related here it is again.
Tedob I am not saying the tutorial is bad, I am simply saying that compared to your normal works... It's a piece of ****...
You have some of the best written tutorials I have seen on this site, and compared to those this explains very little... It's an alright right up for any beginner to VI....
I guess I was expecting more with your track record...