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

sql-formatter

by kufii ALL Trending

A Sublime Text plugin that runs the cli-sql-formatter node library on the current file

Details

Installs

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

Readme

Source
raw.​githubusercontent.​com

sublime-sql-formatter

A Sublime Text plugin that runs the cli-sql-formatter node library on the current file. cli-sql-formatter is in turn a command line interface for the sql-formatter node library.

Installation

Dependencies

This plugin requires node.js, and also requires cli-sql-formatter to be globally installed.

npm install -g cli-sql-formatter

Plugin Installation

This plugin is installable via Package Control

To install via Package Control, do the following:

  1. Within Sublime Text, bring up the Command Palette and type install. Among the commands you should see Package Control: Install Package. If that command is not highlighted, use the keyboard or mouse to select it. There will be a pause of a few seconds while Package Control fetches the list of available plugins.

  2. When the plugin list appears, type sql-formatter. Among the entries you should see sql-formatter. Select this entry to install it.

Commands

Command Palette

  • Format SQL: Runs the formatter with the default dialect defined in your settings.
  • Format SQL With Dialect: Runs the formatter with a dialect of your choosing.

Default Hotkeys

By default, these hotkeys will run the formatter with the default dialect defined in your settings.

  • Linux/Windows: [Ctrl + KQ]
  • Mac: [Cmd + KQ]

Settings

By default the following settings are used:

{
    // The paths to look for executables
    "paths": {
        "linux": [],
        "osx": [],
        "windows": []
    },

    // The default dialect to use for formatting
    // Options:
    // "sql" - Standard SQL
    // "n1ql" - Couchbase N1QL
    // "db2" - IBM DB2
    // "pl/sql" - Oracle PL/SQL
    "default_dialect": "sql",

    // The number of spaces to indent with
    "indent_size": 2,

    // Indent with tabs instead of spaces
    "use_tabs": false
}

You can modify any settings by going to Preferences > Package Settings > sql-formatter > Settings.

Project-Specific Settings Override

To override global plugin configuration for a specific project, add a settings object with an sql-formatter key in your .sublime-project. This file is accessible via Project -> Edit Project.

For example:

{
    "folders": [
        {
            "path": "."
        }
    ],
    "settings": {
        "use_tabs": true
    }
}