ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Es​Formatter

by piuccio ST2/ST3

JavaScript formatter plugin for Sublime Text

Details

Installs

  • Total 14K
  • Win 7K
  • OS X 6K
  • Linux 2K
Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3
Windows 2 1 1 5 6 6 4 3 2 3 9 8 14 12 2 1 4 5 6 5 9 7 4 4 4 5 8 6 8 5 3 7 3 10 7 10 4 1 4 6 5 6 7 2 4 6
OS X 1 5 1 3 6 5 6 2 2 2 2 4 3 5 8 1 2 2 2 1 3 5 1 3 0 3 4 9 5 3 4 4 1 3 9 9 7 1 3 6 8 1 7 1 3 2
Linux 0 0 0 0 2 0 1 1 0 0 2 0 3 4 1 1 1 4 3 3 5 2 0 0 0 0 1 1 2 0 0 0 4 4 1 2 1 1 1 1 2 1 1 3 0 4

Readme

Source
raw.​githubusercontent.​com

Sublime EsFormatter - Sublime Text Plugin

Sublime EsFormatter is a JavaScript formatter plugin for the text editor SublimeText 2/3.

It is based on esformatter, an extremely configurable JavaScript formatter.

Unlike other beautifiers it gives complete control over the coding style.

Requirements

You MUST have Node.js installed globally and included in your $PATH.

You can either install esformatter globally or under your current project's node_modules folder. This complicates the setup slightly but you can configure things anyway you want.

npm install -g esformatter

Installation

Using Sublime Package Control just search for

EsFormatter

Manual installation

This is not recommended, but if you know what you're doing, go on:

Clone this repository or download and unzip inside

Mac

  • ~/Library/Application Support/Sublime Text 3/Packages/EsFormatter

Windows XP

  • C:\Documents and Settings\<user>\Application Data\Sublime Text 3\Packages\EsFormatter

Windows 7 * C:\Users\<user>\AppData\Roaming\Sublime Text 3\Packages\EsFormatter

Linux

  • ~/.Sublime Text 3/Packages/EsFormatter

Usage

The default keyboard mapping is ctrl+alt+f or cmd+alt+f (that is super+alt+f).

You can change the key binding at: Sublime Text -> Preferences -> Package Settings -> EsFormatter -> Key Bindings - User.

{
  // ES Formatter key binding
  "keys": ["ctrl+alt+f"], "command": "esformatter"
}

If you are using a custom keyboard mapping, you may want to add the following line in order to restore the Replace Panel default functionality.

{ "keys": ["super+alt+f"], "command": "show_panel", "args": {"panel": "replace", "reverse": false} },

You can also run EsFormatter automatically when saving a file: Sublime Text -> Preferences -> Package settings -> EsFormatter -> Settings - User.

{
    // Format the file when saved
    "format_on_save": false
}

Configuration

You can configure the options from .esformatter file, either in your project on globally in your home directory.

Refer to the configuration of esformatter

Contribute

The python script simply calls the global version of esformatter. Make sure your changes work on all platforms.