Mac OS

macOS: Preview source code files in Finder with Quick Look plugins

macOS Finder offers a possibility to preview the files of any type without opening them with Quick Look. By default Quick Look supports most commonly used file formats which may not be enough if you are a developer and you want to preview source code files i.e. Java or Python or any other un-common file types.

Quick Look plugins

Quick Look can be extended with plugins to allow previewing the content of any file format. Plugins can also add additional functionality to Quick Look like for example syntax highlighting.

The list of freely available Quick Look plugins for developers can be found here: https://github.com/sindresorhus/quick-look-plugins

The most useful ones from my point of view:

  • Preview files with no extension with QLStephen:

    brew cask install qlstephen

Example: preview .gitignore:

  • Preview Markdown files in Finder with QLMarkdown:

     brew cask install qlmarkdown

Example: preview README.md:

  • Syntax highlighting for source code files with QLColorCode

     brew cask install qlcolorcode

Example: preview JavaScript file:

Tips and Tricks

Quick Look in fullscreen

The default key binding for Quick Look is Spacebar If you you want to preview the file in fullscreen press Option+Spacebar. To leave the fullscreen press Esc.

Change default editor for selected file types

To change the default app for the selected file type (also in Quick Look):

  1. Select the file in Finder
  2. Show file info with Command+I
  3. Set Open With to your application (e.g. Atom)
  4. Click Change All to apply changes to all files of that type

Now when you for example preview the file with Quick Look your default editor will be the one you just selected.

More macOS tips:

macOS: Annotate – simple yet productive screenshots tool

Published on System Code Geeks with permission by Rafal Borowiec, partner at our SCG program. See the original article here: macOS: Preview source code files in Finder with Quick Look plugins

Opinions expressed by System Code Geeks contributors are their own.

Rafal Borowiec

Software developer, Team Leader, Agile practitioner, occasional blogger, lecturer. Open Source enthusiast, quality oriented and open-minded.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button