explicitly using vim (rather than the vi alias) is supposed to give the return code behavior you prefer.