Alex Rivera | Logout

Prevent vim from opening binary files accidentally?

Asked 2011-04-26T16:14:10.217
16

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?

Edit
Report

1 Answer

1

Maybe you can find this useful:

set wildmenu
set wildmode=longest,list

(taken and using from How do I make vim do normal (bash like) tab completion for file names?)

answered 2011-09-18T16:13:25.593

Your Answer