✍️ A Sublime Text 3 plugin for Prettier
Switch branches/tags
Clone or download
drudv Merge pull request #18 from danreeves/custom-config-locations
Custom config locations to search
Latest commit c562cee Feb 19, 2018


No Maintenance Intended

See alternative: Package Control | Repo


This is a Sublime Text 3 plugin for the prettier JavaScript formatter.


You need prettier installed globally for this plugin to work. See the installation instructions.

npm install -g prettier


  1. Go to

    • (Mac OS/OS X): ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/"
    • (Windows): C:\Users\[username]\AppData\Roaming\Sublime Text 3\Packages
  2. git clone git@github.com:danreeves/sublime-prettier.git or download the zip and extract to that location.


Command Palette

Format the entire file:
Prettier: Format this file
Format the current selection(s):
Prettier: Format this selection


  • Linux: ctrl+alt+p
  • Windows: ctrl+alt+p
  • OS X: ctrl+alt+p

You can add custom key bindings using the commands prettier and prettier_selection.


The plugin takes the same settings and the prettier tool. See the prettier repo or this repo. You can configure them in Sublime at Preferences > Package Settings > Prettier.

You can turn on the auto formatting on save by setting autoformat to true.

By default prettier config is searched by prettier --find-config-path, but you can define custom locations to search through configLocations.

For example:

  // Turns on/off autoformatting on save
  "autoformat": true,

  // Only attempt to format files with extensions set there
  "extensions": ["js", "jsx"],

  // Fit code within this line limit
  "printWidth": 80,

  // Number of spaces it should use per tab
  "tabWidth": 2,

  // Use the flow parser instead of babylon
  "useFlowParser": false,

  // If true, will use single instead of double quotes
  "singleQuote": false,

  // Controls the printing of trailing commas wherever possible
  "trailingComma": false,

  // Controls the printing of spaces inside array and objects
  "bracketSpacing": true,

  // Try prettier config in the user's home folder and in current opened folder
  "configLocations": ["${home_path}/.prettierrc", "${folder}/.prettierrc"]