Saving changes
To quit vi and save the contents of the buffer to the file that vi is being used to edit:
ZZ
or
:wq