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

  • 1.1.3
  • github.​com
  • github.​com
  • 10 years ago
  • 40 minutes ago
  • 10 years ago

Installs

  • Total 143K
  • Win 76K
  • Mac 49K
  • Linux 17K
May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29
Windows 14 3 16 17 16 15 19 23 1 2 9 11 11 13 12 15 8 15 15 11 20 13 4 5 19 23 36 20 19 6 7 22 18 18 21 19 7 6 9 13 15 21 10 3 3 15
Mac 15 3 8 13 19 16 15 22 4 2 6 12 12 15 12 12 2 14 12 15 18 15 4 5 16 18 22 17 17 3 3 13 18 11 18 17 12 6 8 10 12 19 9 2 2 10
Linux 2 1 0 4 3 2 2 2 1 2 2 2 2 5 2 3 1 1 4 5 4 1 1 0 1 7 3 3 4 0 0 3 3 0 3 2 1 1 2 0 6 4 3 2 1 0

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.