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

sql-formatter

by kufii ALL

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

Details

Installs

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

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