So I have a folder open in Sublime Text 3.
This folder contains a structure like this:
src
build // I would like to hide this folder
.sass-cache // and this folder
node_modules // and this folder
task
test
In the folders pane on the left (the sidebar), I get the above folders. I would like to hide some of them from view and only see the remaining folders.
Is there a way to achieve folder hiding using a list or another file which is loaded on launch?
I was thinking something like a .gitignore file or such, which just lists folders or patterns to hide things from view.
You need to set "folder_exclude_patterns" and/or "file_exclude_patterns" in your preferences. The defaults are as follows:
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"],
"file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db", "*.sublime-workspace"]
Select Preferences -> Settings—User, then add the following line:
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules", ".sass-cache", "build"]
If you are working in a project, select Project -> Edit Project, and add the line above to the "settings" dict. In both cases, make sure the file is valid JSON.
For reference, here's a minimum working example for a project file with excluded files and folders:
{
"folders":
[
{
"path": ".",
"file_exclude_patterns": ["*.sublime-project", "*.sublime-workspace"],
"folder_exclude_patterns": [".idea", "__pycache__"]
}
]
}
Related
I have numerous .bundle files and i want to delete/remove them (Using terminal)after finding a specific text inside info.plist they contain.(each .bundle contain info.plist)
for example i want to search for "Test" in NSHumanReadableCopyright
<key>NSHumanReadableCopyright</key>
<string>Test</string>
and if "Test" is the string i want to delete the folder that contains it. ( the Info.plist is located in Bundle_name.bundle/Contents/Info.plist >> so i want to delete Bundle_name.bundle.)
Thanks!
The archive:exclude rules below are doing everything I want except the .wordpress-org directory is included (it shouldn't be) because it has force-allowed file types, such as SVG at .wordpress-org/icon.svg (along with other force-allowed file types like PNG).
...
"archive": {
"exclude": [
"*",
".*",
"*/",
"!vendor/*",
"!dist/*",
"!languages/*",
"!*.{bmp,csv,gif,jpg,jpeg,pdf,php,png,svg,tiff,txt,webp}",
"node_modules/"
]
},
...
So how do I force-include bmp,csv,gif,jpg,etc... file extensions *unless they're in the root dir's .wordpress-org directory?
I tried "!/!(.*/).{bmp,csv,gif,jpg,jpeg,pdf,php,png,svg,tiff,txt,webp}" (thanks to some researching at https://globster.xyz/), but that didn't do the trick.
Thanks for any help!!!
I believe ".*" means everything that starts with "." is gonna be excluded, ".wordpress-org" falls under that criteria
is it possible to hide all the files with certain extension from the sidebar (lateral nav bar) in Sublime Text Editor 3?
Are you talking about the sidebar? For example, if you select File → Open and select a folder, then the folder and its contents are displayed along the left side, allowing you to navigate amongst its contents and sub-directories. If that is the case, then the answer is yes, files can be excluded.
Select Preferences → Settings – Default to open a tab called Preferences.sublime-settings – Default. This file is read-only, so you'll also need to open Preferences → Settings – User. The first time you open your user preferences it will be blank. It (and all Sublime config files) are in the JSON format, so you'll need opening and closing curly braces at the beginning and end of the file, respectively:
{
}
Activate the default preferences tab and search for file_exclude_patterns (which is on line 377 in ST3 build 3083) and also folder_exclude_patterns if desired. Copy its contents to your user preferences file, like so:
{
"file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db", "*.sublime-workspace"]
}
and feel free to add your own customizations. Please note that there is no comma (,) after the closing square bracket, as in this example this is the only customized preference. If you have multiple ones (changing fonts, window options, themes, or whatever) you'll need a comma after each item except the last one (trailing commas are illegal JSON):
{
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"word_wrap": true,
"wrap_width": 0
}
You can also set them up per project and ignore folders, in your .sublime-project file, e.g.:
{
"folders": [{
"path": ".",
"folder_exclude_patterns": [".svn", "._d", ".metadata", ".settings"],
"file_exclude_patterns": ["*.pyc", "*.pyo", ".project"]
}]
}
Is there a way to filter out files by extension in Sublime Text?
add file_exclude_patterns to your user preferences file. this is how mine looks like:
"file_exclude_patterns":
[
"*.tmTheme.cache",
"*.tmPreferences.cache",
"*.tmLanguage.cache",
"*.pyc",
"*.pyo",
"*.exe",
"*.dll",
"*.obj",
"*.o",
"*.a",
"*.lib",
"*.so",
"*.dylib",
"*.ncb",
"*.sdf",
"*.suo",
"*.pdb",
"*.idb",
".DS_Store",
"*.class",
"*.psd",
"*.db"
],
In addition to "file_exclude_patterns", you can also use "folder_exclude_patterns".
Referencing this comment from zbynour: with an appropriate product directory structure, combining both directives makes it easy to exclude folders with compiled TypeScript output, sass-cache, etc without excluding e.g. all .js files.
Also, you can specify these exclusions on a per-project basis using your project's .sublime-project file. Here's one of my .sublime-project files, which lives in the project's root directory.
{
"folders":
[
{
"path": ".",
"folder_exclude_patterns": [".sass-cache"],
"file_exclude_patterns": ["*.pdf", "*.psd"]
}
]
}
Of course, you can also use these directives together in your User/Preferences.sublime-settings file. Doing so will of course affect all of your sublime sessions, for all open folders and/or projects, which for me, having forgotten about the setting several months later, caused some bewildering, head-scratching confusion.
Sublime Text 2 - when working on a network drive it create ._ files, and I can't seem to find a settings to turn this feature off.
I had similar problem with TextMate before and the solution was to change OakDocumentDisableFSMetaData property, but I can't find anything similar within Sublime
TextMate solution was:
defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1
http://blog.zachwaugh.com/post/309913111/preventing-textmate-from-creating-files-on-network-drive
Just add ._* to the file_exclude_patterns in your Sublime Preferences.
Or if you don't want it to be overwritten by further updates add this line to your User Prefs
"file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db", "._*"]