如何在NERDTree中按扩展名过滤掉文件?
我希望 *.pyc
文件不要显示在 NERDTree vim 插件中。
如何实现这一目标?
I would like to *.pyc
files not to be shown in NERDTree vim plugin.
How to achieve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要 NERDTreeIgnore 选项。例如,在
.vimrc
中:其中
NERDTreeIgnore
是与要排除的文件匹配的正则表达式数组。You want the
NERDTreeIgnore
option. For example, in your.vimrc
:Where
NERDTreeIgnore
is an array of regular expressions that match the files you want to exclude.刚刚遇到问题:隐藏没有扩展名的二进制文件怎么样?
无法隐藏它们,但可以对文件进行排序以消除一些俗气的混乱。问题如下:
解决方案:
结果:
它将首先对以“.c”结尾的文件进行排序(如果需要,后面可以是其他扩展名)。您不会删除二进制文件,但它变得易于管理。
NERDTree 有一种机制可以检测并突出显示具有额外执行位的文件,其中
-rwxr-xr-x
以粗体显示,文件名末尾带有“*”。添加额外的机制来隐藏可执行文件并不难(对于编译的东西很有用,对于脚本来说不太理想)。Just ran into the problem: What about hiding binary files that do not have an extension?
Can't hide them, but can sort files to eliminate some cheesy clutter. Problem looks like:
Solution:
Result:
which will sort first the files ending with ".c" (followed by some other extension if you want). You don't get rid of the binary files, but it becomes manageable.
NERDTree has a mechanism to detect and highlight files with the extra execute bit, where
-rwxr-xr-x
displays in bold with a "*" at the end of the filename. It would not be hard to add an extra mechanism to hide executable files (useful for compiled stuff, not so desirable for scripts).