Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Use OSX Finder Quicklook (Spacebar) to preview all plain text files (coderwall.com)
181 points by rover on July 11, 2012 | hide | past | favorite | 58 comments



For iOS developers, this one reveals a lot of useful information about provisioning profiles:

http://www.macmation.com/blog/2011/10/quicklook-plugin-for-m...


Hey, thanks a lot. Didn't know about these at all. Cheers.



BetterZip is really good. Thx.



Now that is just awesome. Thank you!


beware though. might not work after latest XCode installation


I don't have XCode installed as of yet. I'm on Mountain Lion and I'm waiting for both the official release of ML and XCode on the App Store. Will XCode for ML still interfere with this plugin or is there any other plugin with similar functionality?


well, i don't really know.


Thanks so much for this. For the longest time I've found it irritating that I couldn't preview plaintext .nfo files with Quicklook.

I didn't realise Quicklook plugins were a thing...


well, so did i. Irritation is the root of all hacks :)


Somehow off topic but this is a very neat trick: You can preview the selected item directly in the Spotlight menu by pressing the left arrow key.

Source: http://www.macstories.net/mac/all-you-need-to-know-about-qui...


Sadly what it does and does not preview seems to be pretty random. For me with Lion it will preview Rakefiles and .txt files for example, but not .js files.


IMO the preview appears automatically after ~2 seconds without having to press any key. Useful feature indeed.


I guess you're right. Though I never recognized this before and since I'm using Alfred, I don't touch Spotlight that often.


On mobile device right now, but earlier today Alfred prompted for a beta update which included some Spotlight features. Not sure about the details or if it's only part of the paid Powerpack


cool stuff !


Suspicious Package http://www.mothersruin.com/software/SuspiciousPackage/ is another neat QuickLook plugin that displays detailed information about Installer Packages (.pkg files).


Yeah, it's pretty sweet.


Nice plugin!

Pro tip: Instead of restarting finder run `qlmanage -r`


Sweet !


I'll take the opportunity to ask: Is there a way to make Spotlight index files in the Library folders? There are sometimes some obscure preference or cache-files that I need to find.


This is 100% off-topic, but since this submission has 100+ upvotes and many might view the comment thread, and you mentioned Library/ folder, I think it's good to point out that you can easily make Library/ folder visible again in Lion.

Just type:

    chflags nohidden ~/Library
in the Terminal.


You can also access hidden directories from Finder with Cmd-Shift-G and manually typing their path.

Personally, I infrequently access my ~/Library and I know it's there and what it contains and I can hop over to it quickly if needed that I prefer it hidden for visual simplicity.


You'll definitely find what you're looking for here. http://www.macosxtips.co.uk/index_files/terminal-commands-fo...

To save you some time, add a folder as follows:

mdimport -f /Library


On recent OS X versions (Lion at the very least), the problem isn't that /Library and ~/Library aren't indexed by default; they are. Trouble is that if I search for a file named, say "com.apple.RemoteDesktop.plist", Finder appears to run a query akin to

    kMDItemDisplayName == "com.apple.RemoteDesktop.plist"
    && kMDItemSupportFileType != MDSystemFile
which returns nothing on my system, rather than simply

    kMDItemDisplayName == "com.apple.RemoteDesktop.plist"    
which returns three results, one each in subdirectories of /System/Library, /Library, and ~/Library.

There's an option in the "full" Spotlight search window that lets you control this for any given search, under "Other..." in the drop-down you get when you click "+" to add criteria. It's called, logically enough, "System files".

Incidentally, the mdfind command line tool doesn't have this behavior by default.


If you want a nice GUI, try Tembo (http://www.houdah.com/tembo). Tembo is a Spotlight front-end. Incidentally it searches all indexed locations, including Library folders.


To my knowledge it does index those files, they are just not shown in the search results. You can ask Spotlight to show the system files, see this guide: http://support.apple.com/kb/HT4355


Is there something like this for Chrome? Really annoying having code downloaded instead of displayed.


No. It has to be sent as text/plain for Chrome to view the file if it is on a remote server. The MIME types that are opened in the browser instead of downloaded are hardcoded within the Chrome source.

Numerous feature requests have been submitted[1] to update this functionality and to provide a preferences pane for users to decide how they want different file types handled, but they have been ignored as this behavior is a design decision.

[1] http://code.google.com/p/chromium/issues/detail?id=118204...


Sort of. Some of it will be controlled by the website more than anything else, but anything that comes over ultimately as text/plain can be handled nicely by Sight: https://chrome.google.com/webstore/detail/epmaefhielclhlnmjo...


On a related note, is there any way to get Spotlight to index all text files?


I wouldn't know why you'd want to do so(slowing down the search), but it seems possible (or close enough).

Scroll at the way to "Make Spotlight index source code" here. http://www.macosxtips.co.uk/index_files/terminal-commands-fo...


That assumes you care about the speed more than the results. Quicksilver or Alfred completely replace Spotlight for anything frequent; I'd be happy if it took 5 minutes, if it could always find what I was looking for.


The command line version of it (mdfind) seems to search the entire file system.


Would it be possible to make the text inside the Quicklook window selectable? I often just want to quickly copy something from a file, and Quicklook would be the fastest way to do so.


Yes there is a way. Open up terminal and type this in:

defaults write com.apple.finder QLEnableTextSelection -bool true

Then restart the Finder by typing in this into the Terminal:

killall Finder


Why isn't this the default...? Many thanks :)


defaults write com.apple.finder QLEnableTextSelection -bool TRUE; killall Finder


awesome !


File this under things that should have worked in the first place.


This is fantastic. Always wondered why quick look wasn't set up to parse plain text files just because they had a different extension. Especially Markdown.


Anyone know how to control what the Open with button offers? E.g. it's offering "Open with Sublime Text 2" and I'd rather have an Open with MacVim.


It's pretty simple and managed by OSX.

- Select a filetype you'd want to change the default application for and open the File Info (Cmd+I) - In the "Open with" section, select the app you want to be the default app for the filetype - To persist the default app along the whole filetype, also click the "Change All" button right below it.


You can also hold down the open button and a list of alternate applications that can be used to open the document drops down. Pretty handy.



That's up to the application. You can crack open the app packages for Sublime Text and MacVim and see how their Info.plist files differ. It's also worth looking at the Info.plist for TextEdit, which has a catch-all for all non-executable files.


You can also add a QuickLook directory to your own ~/Library if you are into keeping stuff separated.


Is there any way to change the font or its size in Quicklook?


As always... simple hacks, the best hacks!


:)


Is there such thing as plain text?


well... :)


This is so good


isn't it ? made me a happy person :)


.org files =)


So now opening a text file is "cutting edge?" [1]

[1] http://news.ycombinator.com/item?id=4226539

PS, just like clicking "More" on HN front page after reading a few articles results in a "cutting edge" error.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: