Black formatter for Sublime Text.
It is recommended to use with LSP-pyright.
There is no need to install
black
, but if you install it, it will not affect this package.
You can install python-black
with package control:
- Open your command pallete and type
Package Control: Install Package
. - Find this project
python-black
and pressEnter
.
This package has been uploaded to packagecontrol.io, so you do not need to choose local installation:
git clone https://github.com/thep0y/python-black.git
Copy or move the python-black
folder to the packages
directory of Sublime Text 4.
You can create custom key binding based on samplePreferences - Package Settings - Python Black - Key Bindings
, such as:
{
"keys": [
"ctrl+super+l"
],
"command": "black"
}
⚠️ Note: Do not duplicate the key binding of other packages
There is only one modifiable property in settings:
{
// Whether to automatically format the entire document when saving
"format_on_save": true
}
You can quickly generate a black configuration file for the current project.
Command | Description |
---|---|
python-black: Create Black Configuration File |
Creates a pyproject.toml file in the root of the project with basic options. Opens the configuration file if it already exists. |
- format all python files in the current project
If someone likes or gives feedback, some features may be added in the future.