防止vim意外打开二进制文件? [英] Prevent vim from opening binary files accidentally?
问题描述
当我要打开关联的源代码"foo.cpp"时,我经常不小心打开一个二进制可执行文件,即"foo".问题的根源在于制表符补全,即:e fo<tab>
通常落在二进制文件而不是源代码上.
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.
有没有办法让vim只制表符完整的文本文件名?或者,更改制表符的完成顺序?
Is there a way to get vim to only tab complete names of text files? Or alternatively, change the tab completion order?
有时我的草率选项卡完成错误发生在vim之外;在这种情况下,防止vim打开非文本文件的最佳方法是什么?
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?
推荐答案
不是您所需要的,但是我的.vimrc文件中有类似的内容
Not exactly what you need, but I have something like this in my .vimrc
" ignore these files when completing names and in Ex
set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pdf,*.bak,*.beam
" set of file name suffixes that will be given a lower priority when it comes to matching wildcards
set suffixes+=.old
这篇关于防止vim意外打开二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!