Because you have better things to worry about than formatting your code.
As this plugin merely acts as a proxy, each formatter will require it's own tool and options for code formatting.
Clang (clang-format
)
Supports the C family of languages (C, C++, Objective-C, Objective-C++).
Download clang-format
via you package manager or from the LLVM website.
Elm (elm-format
)
npm install -g elm-format
Go (gofmt
)
Installed with Go
by default. Download go
via your package manager or from the website.
Haskell (hindent
)
stack install hindent
JavaScript (prettier
)
npm install -g prettier
JSON (json
)
Uses the JSON encoder and decoder from the Python standard library.
Python (yapf
)
pip install yapf
Rust (rustfmt
)
cargo install rustfmt
Swift (swiftformat
)
brew install swiftformat
Terraform (terraform fmt
)
Visit the website and follow the instructions to download and install.
- Install Package Control
- Run
Package Control: Install Package
in the Command Palette (Ctrl+Shift+P) - Install
Format
- Install Package Control
- Run
Package Control: Add Repository
in the Command Palette - Add the repository:
https://github.com/Rypac/sublime-format.git
- Run
Package Control: Install Package
in the Command Palette - Install
sublime-format
-
Navigate to the Sublime Text package directory
-
Clone the repository
git clone https://github.com/Rypac/sublime-format.git Format
Format: Format Selection
- Format the current selection
Format: Format File
- Format the current file
Format: Toggle Format on Save
- Toggle formatting on save for all supported source file types
Format: Enable Format on Save...
- Select source file types to enable automatic formatting on save
Format: Disable Format on Save...
- Select source file types to disable automatic formatting on save
Format: Format Selection
- OSX: (Cmd+K, Cmd+S)
- Windows/Linux: (Ctrl+K, Ctrl+S)
Format: Format File
- OSX: (Cmd+K, Cmd+F)
- Windows/Linux: (Ctrl+K, Ctrl+F)