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

Sql​Beautifier

by zsong ST2/ST3

A sublime plugin to format SQL. It supports both sublime 2 and 3.

Details

Installs

  • Total 66K
  • Win 35K
  • OS X 21K
  • Linux 10K
Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10
Windows 8 10 53 52 54 45 20 11 6 34 50 59 60 35 14 12 47 36 54 45 42 13 14 54 42 57 55 28 17 10 44 48 64 44 40 13 19 54 59 51 56 56 16 15 56 74
OS X 3 9 27 26 25 24 29 4 11 28 31 24 37 29 8 7 25 20 35 28 32 6 7 17 33 38 31 25 7 6 18 29 40 35 21 6 7 31 33 34 41 34 11 7 28 20
Linux 5 4 10 10 10 10 8 3 3 10 8 9 8 10 2 4 11 8 14 12 12 2 4 13 8 7 15 9 3 0 6 6 10 12 10 1 6 10 13 16 17 9 5 6 10 10

Readme

Source
raw.​githubusercontent.​com

SqlBeautifier

This is a SQL formatter plugin using python-sqlparse for both Sublime 2 and 3.

Enjoy!

Installation

Please install Sublime Package Control first. Then inside Package Control: Install Package, type SqlBeautifier and then click to confirm.

Settings

The default key binding for Mac is

{ "keys": ["super+k", "super+f"], "command": "sql_beautifier" }
  • Kindly note that the super key here is generally replaced by Command (⌘) key

The default key binding for Windows / Linux is

{ "keys": ["ctrl+k", "ctrl+f"], "command": "sql_beautifier" }

Options for formatter

To change the options, click through Package Settings -> Sql Beautifier -> Settings User and add the overrided options in JSON like this

{
    "indent_tabs": true,
    "indent_width": 1
}

This overrides the default option at Package Settings -> Sql Beautifier -> Settings Default.

Here is the list of options the formatter supports:

  • keyword_case: Changes how keywords are formatted. Allowed values are “upper”, “lower” and “capitalize” and null (leaves case intact).

  • identifier_case: Changes how identifiers are formatted. Allowed values are “upper”, “lower”, and “capitalize” and null (leaves case intact).

  • strip_comments: If True comments are removed from the statements.

  • reindent: If True the indentations of the statements are changed.

  • indent_tabs: If True tabs instead of spaces are used for indentation.

  • indent_width: The width of the indentation, defaults to 2.