Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show binary files in Sublime Text Folder View

I'm using Sublime Text 3 to write C libraries. I want to be able to reference the lib build directory, and see that a binary actually got built. However, Sublime shows the directory as empty.

empty_lib_dir

How can I make the library binaries visible in Sublime Text Folders view?

like image 372
the_storyteller Avatar asked Dec 23 '22 09:12

the_storyteller


1 Answers

What is and is not displayed in the side bar is controlled by the following two settings along with one additional setting to keep in mind (shown here with their default values):

// folder_exclude_patterns and file_exclude_patterns control which files
// are listed in folders on the side bar. These can also be set on a per-
// project basis.
"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"],

// These files will still show up in the side bar, but won't be included in
// Goto Anything or Find in Files
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],

The folder_exclude_patterns automatically blocks a list of folders from appearing in the side bar (here the control directories for version controls systems) while file_exclude_patterns does the same for files and includes among other things compiled object files and library files for several platforms.

In order to have them appear in the side bar, you need to modify the file_exclude_patterns default so that the files you want to see aren't listed.

If you do that, the files will show up in the side bar, but they'll also show up in the list of files to open when you use Goto Anything or when you search in your project. To fix that, you need to add any files that you remove from file_exclude_patterns to binary_file_patterns so that Sublime knows that they're binary and thus not interesting.

To tweak the settings, use Preferences > Settings, then copy the defaults from the left pane to your custom settings on the right, and modify the versions on the right.

Make sure you don't just create new settings without copying the defaults, or you're effectively turning off all of the default excludes, which will probably cause you issues down the line.

like image 67
OdatNurd Avatar answered Jan 10 '23 18:01

OdatNurd