如何在 Sublime Text 中从索引中排除文件夹,同时仍将其显示在侧边栏中? [英] How can I exclude a folder from indexing in Sublime Text, while still showing it in the sidebar?
问题描述
对于具有许多依赖项的大型项目,例如在 node_modules/
文件夹中,由于 Sublime 索引文件夹中的所有文件,我注意到 CPU 频繁出现峰值.
For a large project with many dependencies e.g. in the node_modules/
folder, I noticed frequent CPU spikes because of Sublime indexing all the files in the folder.
我知道我可以使用 folder_exclude_patterns
设置隐藏文件和文件夹,但我仍然希望该文件夹在侧边栏中可见.
I know I can hide files and folders using the folder_exclude_patterns
setting, but I still want the folder to be visible in the sidebar.
我怎样才能保持例如node_modules/
在侧边栏中,但将其从索引中排除?
How can I keep e.g. node_modules/
in the sidebar, but exclude it from indexing?
推荐答案
要从索引中排除文件但将它们保留在侧边栏中,请使用用户设置中的 binary_file_patterns
设置,例如:
To exclude files from the index but keep them in the sidebar, use the binary_file_patterns
setting in your User Settings, for example:
"binary_file_patterns": [
"*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds",
"*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip",
"node_modules/**",
"bower_components/**"
]
确保从您的 Settings - Default
首选项中复制值(此处显示为 "*.jpg"
等),否则您将开始索引二进制文件.
Make sure to copy the values from your Settings - Default
preferences (here shown as "*.jpg"
etc.), or you will start indexing binary files.
这篇关于如何在 Sublime Text 中从索引中排除文件夹,同时仍将其显示在侧边栏中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!