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

sql-formatter

by kufii ST2/ST3

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

Details

Installs

  • Total 6K
  • Win 3K
  • OS X 2K
  • Linux 777
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 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6
Windows 5 4 17 24 21 26 19 5 8 30 23 14 17 24 10 1 14 21 15 19 13 7 7 14 22 22 19 22 6 1 25 21 17 7 17 4 5 12 11 21 13 12 2 5 6 22
OS X 2 2 10 11 14 17 13 1 6 11 12 12 12 4 2 5 8 12 13 9 12 0 0 12 9 14 14 8 1 3 10 13 7 19 13 2 2 7 10 20 11 19 1 2 6 9
Linux 0 1 3 6 8 6 7 0 1 5 2 4 9 5 0 0 4 4 3 6 2 3 1 5 2 7 6 5 2 0 4 5 3 5 4 2 1 7 6 4 7 6 0 2 3 5

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
    }
}