So, on stock Mac OSX Yosemite, if I run vi /tmp/foo
and then type in some text, and finally do :Wq
(a common typo I make) and then :wq
. Everything will appear to be fine, but for some reason the exit code will be 1. If I repeat the same thing, but don't do :Wq
then it returns 0.
This is maddening for git commit where I'll type in a commit message, make this mistake and suddenly lose my commit message because git things vi didn't write the file
How can I fix this behavior to not happen anymore and always return 0 unless there is a real error with writing the file?