2

Is there a Quick Look plugin to see the contents of any text file with any extension instead of just showing the icon.

4
  • There are already plenty of ways of viewing the contents of a folder in the Finder, so I'm struggling to see the point of this. If you use Column View, you'll instantly see the contents as soon as you select one. Apple's documentation for developing QuickLook plug-ins is here: developer.apple.com/documentation/quicklook
    – benwiggy
    Mar 8, 2020 at 11:06
  • 1
    Because it’s become a habit to hit the spacebar for a quick look. I could just as easily open a file I want to quick look. So the same reason I hit space bar on a file is the same reason I’d like to be able to see inside a folder when hitting space bar instead of opening it
    – Ted
    Mar 9, 2020 at 14:56
  • @benwiggy I’m not sure why I wrote folder view. I want to be able to Quick Look any file. If it has no extension or is some unrecognized extension it just displays the icon. The point is that I want to Quick Look the contents of README.md, *.php, *.js or even just the text in README. I hope that makes more sense
    – Ted
    Jun 8, 2020 at 13:11
  • 1
    Ted, I removed the software development question as it's off-topic for this site. You can ask it on Stack Overflow. Jun 9, 2020 at 17:01

3 Answers 3

2

Is there a Quick Look plugin to see the contents of any text file with any extension instead of just showing the icon.

The short answer is “no.”

Can you develop quick look plugins? Of course you can! However, things fall short with the requirement of any text file with any extension.

Files types and their associations, like what to open it with, what to edit it with and even what icon to show are all handled by LaunchServices. The problem with “any file/any extension” is there’s no way to associate that with a particular quick view plugin. For example which plugin would be associated with the shell script I wrote called foobar and the binary data file barfoo both with no extension? Not all “no extension” files are of the the same type; in your case, text.

You can get more information regarding LaunchServices from the Development Guide

2

I use Sublime Text so I picked some extension-less files &:

  • Right click > Get info.
  • Open with "Sublime Text" & change all.

Then sublime handles it for all the files that it can read through. Be careful with executable/ scripts though. Don't double click on them. A new kMDItemContentType can ditch you there.

For other files with recognised extensions, .php, .py etc, you'd have to change them individually, per format.

1
  • Not QuickLook but a good solution. That’s basically what I do now
    – Ted
    Jun 9, 2020 at 17:23
1

There are quick look plugins that you can use to have the right app be used for quick look. These are stored in Library/Quicklook and ~Library/Quicklook. To view these files right-click on them and select View Contents. There is a repository of Quick Look plugins located here.. These can be easily installed manually. There is a more thorough description of this at this link. There are instructions to build a Quick Look plugin here.

2
  • I understand there are various plugins for various specific file types. I want something that will display the text content for unknown file extensions without having to create a plugin for each possible text file extension
    – Ted
    Jun 9, 2020 at 16:54
  • My last link is instructions to build your own quick look plugin. maybe that will help you.
    – Natsfan
    Jun 9, 2020 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .