Vi takes the value of $TERM and looks up the characteristics of that terminal in the file /etc/termcap. If you don't know vi's name for the terminal you are working on, look in /etc/termcap.
When vi starts, it attempts to read the variable EXINIT from your environment.* If that exists, it takes the values in it as the default values for certain of its internal constants. See the section on "Set Values" for further details. If EXINIT doesn't exist you will get all the normal defaults.
Should you inadvertently hang up the phone while inside vi, or should the computer crash, all may not be lost. Upon returning to the system, type:
vi -r file