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
  • 36 minutes ago
  • 10 years ago

Installs

  • Total 144K
  • Win 77K
  • Mac 50K
  • Linux 18K
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 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 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
Windows 0 13 23 16 16 19 1 2 16 4 24 19 22 6 8 23 18 20 21 21 2 5 15 26 28 21 18 5 1 12 20 20 20 12 2 1 17 20 23 14 13 8 5 11 28 21
Mac 0 10 14 6 15 12 1 1 8 11 12 16 13 2 3 3 12 20 18 11 1 3 7 15 28 23 13 3 4 18 15 10 22 16 1 5 17 12 13 17 13 3 1 14 16 19
Linux 0 2 1 2 3 2 1 1 1 6 0 2 2 1 1 1 2 3 1 2 1 2 7 11 3 0 2 2 0 0 4 2 2 3 1 2 1 1 2 1 3 0 1 3 3 1

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.