如何在NERDTree中按扩展名过滤掉文件?

发布于 2024-10-31 10:20:09 字数 73 浏览 4 评论 0原文

我希望 *.pyc 文件不要显示在 NERDTree vim 插件中。

如何实现这一目标?

I would like to *.pyc files not to be shown in NERDTree vim plugin.

How to achieve that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

阳光①夏 2024-11-07 10:20:09

您需要 NERDTreeIgnore 选项。例如,在 .vimrc 中:

let NERDTreeIgnore = ['\.pyc

其中 NERDTreeIgnore 是与要排除的文件匹配的正则表达式数组。

]

其中 NERDTreeIgnore 是与要排除的文件匹配的正则表达式数组。

You want the NERDTreeIgnore option. For example, in your .vimrc:

let NERDTreeIgnore = ['\.pyc

Where NERDTreeIgnore is an array of regular expressions that match the files you want to exclude.

]

Where NERDTreeIgnore is an array of regular expressions that match the files you want to exclude.

ㄖ落Θ余辉 2024-11-07 10:20:09

刚刚遇到问题:隐藏没有扩展名的二进制文件怎么样?

无法隐藏它们,但可以对文件进行排序以消除一些俗气的混乱。问题如下:

file1*
file1.c
file2*
file2.c

解决方案:

let NERDTreeSortOrder=['\.c

结果:

file1.c
file2.c
file1*
file2*

它将首先对以“.c”结尾的文件进行排序(如果需要,后面可以是其他扩展名)。您不会删除二进制文件,但它变得易于管理。

NERDTree 有一种机制可以检测并突出显示具有额外执行位的文件,其中 -rwxr-xr-x 以粗体显示,文件名末尾带有“*”。添加额外的机制来隐藏可执行文件并不难(对于编译的东西很有用,对于脚本来说不太理想)。

]

结果:

它将首先对以“.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:

file1*
file1.c
file2*
file2.c

Solution:

let NERDTreeSortOrder=['\.c

Result:

file1.c
file2.c
file1*
file2*

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).

]

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文