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

Sql​Beautifier

by zsong ALL

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

Details

Installs

  • Total 126K
  • Win 68K
  • Mac 42K
  • Linux 16K
Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16
Windows 25 33 20 34 19 7 8 23 22 39 24 27 9 7 24 30 19 29 22 10 11 28 38 24 34 22 6 6 32 20 27 24 17 7 9 19 33 19 34 25 7 9 23 33 26 24
Mac 23 24 29 21 23 5 6 19 30 27 30 22 6 1 19 29 30 24 16 4 8 22 29 29 27 21 4 6 27 30 23 26 22 7 4 19 32 23 27 22 8 2 23 22 26 26
Linux 4 5 10 2 3 0 1 0 6 0 5 4 0 0 5 7 7 5 7 4 1 2 3 3 10 5 0 1 5 2 7 2 2 1 2 6 7 6 2 4 0 0 3 1 8 3

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.