Next time you post a thread how about you read the few small sentences next to the text box for the thread title.
What do you mean? The text file you are editing or vi's settings?
If the text file then :x or ZZ will save the file and close vi; :w will just save the file.
If your on about vi's settings I just set them in ~/.vimrc