Home Download Buy Blog Forum Support

Prevent preview of binary files

Prevent preview of binary files

Postby phillip.koebbe on Tue Jan 10, 2012 3:26 pm

Is there a way to prevent preview of binary files? For example, if I click on an image in the sidebar, the hex shows up in the text panel. I'd rather not see that. I don't normally click on images in my text editor, but it does happen occasionally. It is also a problem when using Go To File and mistyping a file name. This actually happened to me this morning. I was looking to open a particular file, mistyped the name, and suddenly saw a blue progress bar working its way across the text area. It turns out that the Go To File had landed on a flash video about 30 Mb. I just don't need that to happen.

[... checking preferences ...]

I found folder and file exclude patterns in global settings, but I'd kind of like to leave the references to the files in the sidebar. I also saw binary file pattern to keep binary files out of Go To *, which will solve the problem I encountered this morning. So it comes down to being able to leave binary files in the sidebar but not showing a preview of them if clicked. Possible?
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Prevent preview of binary files

Postby C0D312 on Tue Jan 10, 2012 4:56 pm

It's not possible, but I don't see why you'd need a 30mb flash video in your ST project. You can look into the following settings (found in your "default global settings" but you'll want to add them to your user settings to preserve them from updates):
Code: Select all
folder_exclude_patterns

file_exclude_patterns

binary_file_patterns


Adjust these settings to remove images and videos from showing up in the Goto panel or the sidebar.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Prevent preview of binary files

Postby tito on Tue Jan 10, 2012 5:56 pm

I generally have all the files for same project in project folder. There is binary files there.

I agree there should be a built-in way to disable preview. As I say previously, is not the preview feature that is bad. The real problem is that steal focus of focused tab which is very distracting.

There is also situations on which you want to just do some quickly file operations such copy, duplicate or paste for binary files, and the editor hangs when you just click that files.

I wrote some useful feedback about this behaviour which was ignored viewtopic.php?f=2&t=3477#p16431

Regards,
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 854
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Prevent preview of binary files

Postby tito on Tue Jan 10, 2012 5:58 pm

folder_exclude_patterns

file_exclude_patterns

binary_file_patterns

These settings don't help because remove the files from the sidebar. I prefer to see if there is some real file there, before deleting a folder, etc.
There is also a plguin I wrote "NoPreview" which is not perfect but good enough to at last workaround this .
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 854
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Prevent preview of binary files

Postby phillip.koebbe on Tue Jan 10, 2012 8:37 pm

C0D312 wrote:It's not possible, but I don't see why you'd need a 30mb flash video in your ST project.


I don't use projects. I just open folders. I prefer to see everything that's there. Suppose I'm making an image tag in a web app and I can't quite remember the name of the file, I can go over to the sidebar and scroll down a little bit and see it. Otherwise, I have to leave the ST2, go to Finder or Path Finder or Terminal and do it. It's less intrusive/distracting to be able to stay in ST2. Before I started using ST2, I used TextMate and I had to filter out a lot of files for performance reasons. But ST2 is so incredibly fast, I don't want to filter them out unless I have to.

C0D312 wrote:You can look into the following settings (found in your "default global settings" but you'll want to add them to your user settings to preserve them from updates):
Code: Select all
folder_exclude_patterns

file_exclude_patterns

binary_file_patterns


Adjust these settings to remove images and videos from showing up in the Goto panel or the sidebar.


I guess you didn't get that in my original post...I should have looked before posting, but I looked while posting and saw those options. I added *.flv to binary_file_patterns so now I don't have to worry about Go To hitting it. The rest will just depend on me not clicking on binary files. And that's totally reasonable. I'm not complaining that ST2 can't do it, just wondering if it can.

Peace.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Prevent preview of binary files

Postby C0D312 on Tue Jan 10, 2012 8:51 pm

phillip.koebbe wrote:I guess you didn't get that in my original post...


Whoops. Guess I missed that. That's my bad, sorry.

Suppose I'm making an image tag in a web app and I can't quite remember the name of the file, I can go over to the sidebar and scroll down a little bit and see it.


That makes sense. I can see a use for having them in the sidebar.

The fact that when you click on an image or a video, Sublime hijacks the current buffer with the preview becomes very intrusive. So, I definitely agree that this could be improved.

As for inserting an image tag or similar into Sublime Text, once I get some free time (I have exams this week, ugh) I'm going to make a plugin that will autocomplete filenames that are in your sidebar. Should make things like a and img tags a lot easier.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 26 guests