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 83K
  • Win 45K
  • OS X 26K
  • Linux 12K
Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8
Windows 34 41 49 38 7 7 25 39 35 40 24 11 15 24 37 42 37 26 8 12 35 39 39 47 31 13 10 45 48 32 25 33 12 7 53 43 38 50 37 14 15 32 40 47 45 34
OS X 20 31 17 20 4 5 19 21 24 20 24 7 6 17 26 33 20 14 6 9 23 25 20 25 25 6 8 24 24 14 21 28 9 6 24 22 27 26 23 9 4 21 23 32 21 28
Linux 8 7 6 5 4 1 6 3 5 9 7 3 4 7 7 12 4 5 4 5 5 7 11 6 9 2 5 6 9 9 6 6 2 2 4 6 8 8 11 5 4 7 9 7 13 12

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.