sql-formatter
A Sublime Text plugin that runs the cli-sql-formatter node library on the current file
Details
Installs
- Total 40K
- Win 20K
- Mac 16K
- Linux 4K
Jan 22 | Jan 21 | Jan 20 | Jan 19 | Jan 18 | Jan 17 | Jan 16 | Jan 15 | Jan 14 | Jan 13 | Jan 12 | Jan 11 | Jan 10 | Jan 9 | Jan 8 | Jan 7 | Jan 6 | Jan 5 | Jan 4 | Jan 3 | Jan 2 | Jan 1 | Dec 31 | Dec 30 | Dec 29 | Dec 28 | Dec 27 | Dec 26 | Dec 25 | Dec 24 | Dec 23 | Dec 22 | Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 5 | 12 | 4 | 2 | 1 | 9 | 11 | 8 | 7 | 7 | 0 | 1 | 6 | 7 | 13 | 1 | 4 | 2 | 0 | 3 | 5 | 4 | 4 | 5 | 1 | 2 | 7 | 6 | 10 | 4 | 6 | 5 | 4 | 10 | 9 | 12 | 8 | 7 | 1 | 1 | 7 | 11 | 11 | 12 | 4 | 0 |
Mac | 5 | 11 | 5 | 2 | 3 | 10 | 10 | 5 | 10 | 8 | 0 | 2 | 10 | 5 | 12 | 7 | 9 | 4 | 4 | 7 | 11 | 4 | 5 | 6 | 1 | 1 | 5 | 2 | 2 | 7 | 5 | 1 | 2 | 5 | 13 | 9 | 8 | 7 | 2 | 3 | 4 | 10 | 8 | 11 | 5 | 2 |
Linux | 0 | 1 | 1 | 0 | 1 | 0 | 2 | 3 | 6 | 2 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 2 | 1 | 0 | 1 | 0 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 1 | 1 | 2 | 0 | 2 | 1 | 3 | 3 | 2 |
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
}
}