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:
Note: Are looking for tools to help you being more productive? Read about tools that are essential to me on macOS: macOS: essential tools for (Java) developer
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):
- Select the file in Finder
- Show file info with
Command+I
- Set
Open With
to your application (e.g. Atom) - 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: essential tools for (Java) developer
macOS: Annotate - simple yet productive screenshots tool