sql-formatter
A Sublime Text plugin that runs the cli-sql-formatter node library on the current file
Details
Installs
- Total 45K
- Win 22K
- Mac 18K
- Linux 5K
| 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 | Apr 25 | Apr 24 | Apr 23 | Apr 22 | Apr 21 | Apr 20 | Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | Apr 13 | Apr 12 | Apr 11 | Apr 10 | Apr 9 | Apr 8 | Apr 7 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 5 | 8 | 1 | 13 | 6 | 1 | 0 | 7 | 5 | 7 | 9 | 3 | 2 | 6 | 5 | 6 | 10 | 6 | 1 | 2 | 1 | 1 | 6 | 8 | 7 | 4 | 0 | 1 | 7 | 5 | 1 | 5 | 9 | 1 | 0 | 7 | 9 | 9 | 8 | 9 | 1 | 1 | 6 | 6 | 2 | 9 |
| Mac | 1 | 3 | 8 | 5 | 0 | 1 | 3 | 7 | 4 | 5 | 5 | 4 | 1 | 1 | 1 | 7 | 4 | 3 | 5 | 0 | 2 | 4 | 7 | 2 | 7 | 8 | 1 | 2 | 8 | 7 | 8 | 5 | 4 | 0 | 2 | 4 | 2 | 9 | 6 | 9 | 0 | 0 | 2 | 9 | 5 | 12 |
| Linux | 0 | 1 | 2 | 1 | 0 | 1 | 0 | 3 | 1 | 2 | 3 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 5 | 0 | 0 | 1 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 2 | 2 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 0 | 1 | 0 | 1 | 0 |
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:
Within Sublime Text, bring up the Command Palette and type
install. Among the commands you should seePackage 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.When the plugin list appears, type
sql-formatter. Among the entries you should seesql-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
}
}