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 9K
  • Win 5K
  • OS X 3K
  • Linux 1K
Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3
Windows 5 5 19 21 24 24 15 3 2 14 25 18 26 21 5 8 16 22 15 21 11 2 2 11 36 21 19 22 3 4 16 25 21 14 13 4 9 14 26 22 20 15 2 5 16 22
OS X 2 7 9 10 21 11 11 3 2 11 13 18 8 13 4 8 11 11 9 10 13 2 5 8 12 17 16 7 4 3 4 16 18 13 11 7 8 14 30 13 8 6 4 3 4 12
Linux 1 0 2 5 6 4 6 1 1 4 4 7 3 1 2 4 5 4 3 2 2 0 2 3 4 7 6 5 0 0 3 2 9 1 3 0 2 3 5 3 3 3 0 1 2 4

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