I frequently accidentally open a binary executable, i.e. "foo", when I mean to open the associated source code "foo.cpp". The root of the problem is that tab completion, i.e. `:e fo<tab>` typically lands on the binary instead of the source code. 

Is there a way to get vim to only tab complete names of text files? Or alternatively, change the tab completion order?

Sometimes my hasty tab completion error happens outside of vim; for those cases, what is the best way to prevent vim from opening files that are not text?