Make OS X's Quick Look work for custom file extensions

54

30

I find Finder's Quick Look feature (launched with Space) very useful, but it works only for a limited number of file extensions. In work I often get .properties, .conf, .ddl and other files which are essentially text, yet in Quick Look their content is never displayed:

alt text

Is there any way I can tell my Mac to treat those files as text?

Thanks!

Nikita Rybak

Posted 2011-01-07T10:49:26.470

Reputation: 655

Answers

41

QLStephen adds support for both files without a filename extension (like README) and files with arbitrary extensions (like file.xyz).

Lri

Posted 2011-01-07T10:49:26.470

Reputation: 34 501

It's not the bin directory that blocks QLStephen; it's the executable file permissions. – Elliott B – 2014-09-24T07:58:14.287

What do I do once I install it? The README says - Make sure you are editing (a) the correct plist of (b) the correct bundle. (For example, you might have twoQLStephenplugins. It’s possible the plugin in another directory—perhaps/Library/QuickLook/—is what is being read. but it doesn't say what plist I'm supposed to edit or what I'm supposed to add to that file. – incandescentman – 2015-07-31T23:18:57.120

4Apparently QLStephen is now available on homebrew as brew cask install qlstephen – Pushpendre – 2016-02-08T02:42:53.480

2The way to do this is to add public.data to any quicklook generator's plist. The downside is that binary files also do not have an extension and so it will try to display them, albiet usually with no negative consequences – Brandon – 2011-11-24T10:06:51.967

@Brandon - it appears there is a directories blacklist in QLStephen which prevents files with no extensions from being shown if they are in the bin directory, also there is a whitelist which enables it for README and files of that sort which could work. I'm having trouble getting this to work on ML tho. – cwd – 2012-10-18T17:43:35.780

10

You might also want to have a look at the QLColorCode and QLMarkdown plugins, for syntax highlighting of many languages and markdown rendering respectively.

http://code.google.com/p/qlcolorcode/

http://github.com/toland/qlmarkdown/

_c

polypus74

Posted 2011-01-07T10:49:26.470

Reputation: 201

8

A search for quicklook on github reveals that there is a large variety of extensions available:

and some (incomplete) collections:

Ioannis Filippidis

Posted 2011-01-07T10:49:26.470

Reputation: 230

5

It's possible, but not really easy.

If you look at /System/Library/QuickLook/Text.qlgenerator/Contents/Info.plist, you'll notice that the "text" preview is for the following UTIs:

public.plain-text
public.rtf
com.apple.rtfd
org.oasis-open.opendocument.text
com.apple.property-list
public.xml

This is how QuickLook knows which Plugin (qlgenerator) to use.


A (hackish) solution now would be to assign the extension properties the UTI public.plain-text. To do this, you could create a dummy application (e.g. created by Automator) that declares these file types like described here, only you'd use public.plain-text as UTI and properties as file extension.

Daniel Beck

Posted 2011-01-07T10:49:26.470

Reputation: 98 421

In the end, I've added custom file types to existing text editor (TextWrangler). Works fine, thanks! – Nikita Rybak – 2011-01-09T00:23:26.620

1@Nikita It's easier, but be aware that any TextWrangler update will nuke your changes to Info.plist. – Daniel Beck – 2011-01-09T08:32:26.777

I want to add a couple of extensions (.scala, .clj, .properties), what should I do? – Chiron – 2011-03-06T12:28:34.853

@4bu3li Do what I wrote in my answer and it'll work, I just did it yesterday the same way. Or do you just require a more detailed explanation? – Daniel Beck – 2011-03-06T12:51:07.273

I would like i more detailed explanation. Can't i not just add public.pde for example in the plist? – clankill3r – 2013-05-11T10:50:25.533