If u do mean vi then i do like this in Red Hat distro:
1) "Insert" key to enable u to type in the file u wish to edit. Then start typing
2) Now, press "Esc" if u finish typing.
3) Type ":" followed by "w" to save. ----> ":w"
4) Press "Esc" again and type ":" followed by "q!" to quit without saving. ----->":q"
OR
Just press "Shift" + "zz" (zz = press "z" twice) to save and quit vi.