isorted
isort integration for Sublime Text
Details
Installs
- Total 489
- Win 95
- Mac 227
- Linux 167
Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 1 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
isorted
__
/ / __ __
---________ _____/ /____ ____/ /
/ / ___/ __ \/ ___/ __/ _ \/ __ /
/ /__ / /_/ / / / /_/ __/ /_/ /
/_/____/\____/_/ \__/\___/\__,_/
isort
integration for Sublime Text. Make your imports great again.
Allows to use any externally installed isort
by your favorite package manager…
Installation
Just find isorted
in Package Control
or install manually by navigating to Sublime's Packages
folder and cloning this repository:
git clone https://github.com/rimvaliulin/isorted.git
Install isort
if you haven't already:
pip3 install isort
Configuration
isort
config files
isort
looks for the closest supported config files in the order listed: .isort.cfg
, pyproject.toml
, setup.cfg
, tox.ini
and .editorconfig
(.isort.cfg
and pyproject.toml
are preferred formats). isort
will traverse up to 25 parent directories until it finds a suitable config file. isort
will not leave a git or Mercurial repository (checking for a .git or .hg directory). As soon as it finds a file, it stops looking. The config file search is done relative to the current directory if isort
or a file stream is passed in, or relative to the first path passed in if multiple paths are passed in. isort
never merges config files together due to the confusion it can cause. You can manually specify the settings file or path by setting --settings-path
from the command-line. See more: https://pycqa.github.io/isort/docs/configuration/config_files.html
Project settings
Add a isort
command line options to Sublime Text settings (see: isort --help
). Use long arguments (double dashed) and change hyphens to underscores to better look. This settings will be added directly to command line call and override any isort
config file settings: .isort.cfg
, pyproject.toml
, setup.cfg
, tox.ini
, .editorconfig
etc.
Just add isorted
as prefix:
{
"settings": {
"isorted.isort_command": ["poetry", "run", "isort"],
"isorted.isort_on_save": true,
"isorted.profile": "black",
"isorted.float_to_top": true,
"isorted.line_length": 120
}
}
Or in isorted
subsettings:
{
"settings": {
"isorted": {
"isort_command": ["${python_interpreter}", "-m", "isort"],
"isort_on_save": true,
"profile": "django",
"dont_float_to_top": true,
"indent": " ",
"extra_builtin": ["django", "rest_framework"]
}
}
}
Or in options
section of isorted
subsettings:
{
"settings": {
"isorted": {
"isort_command": ["${python_interpreter}", "-m", "isort"],
"isort_on_save": true,
"options": {
"profile": "django",
"dont_float_to_top": true,
"indent": " ",
"extra_builtin": ["django", "rest_framework"]
}
}
}
}
Global/User settings
Preferences
→ Package Settings
→ isorted
→ Settings
Fill user settings with options you like on the left panel:
{
"isort_command": "/usr/bin/local/isort",
"isort_on_save": true,
"options": {
"profile": "pycharm",
"multi_line": "GRID",
"ensure_newline_before_comments": true,
"known_local_folder": ["flask", "requests"]
}
}
isorted
specific options
isort_command
: set custom location forisort
command. Can be list of strings (by default: “isort”).isort_on_save
: always runisort
before saving the file (by default: false).
Key Bindings
Preferences
→ Package Settings
→ isorted
→ Key Bindings
:
Copy to user key bindings, uncomment, edit keys and and save:
[
{"keys": ["ctrl+alt+s"], "command": "isort_file", "scope": "source.python"}
]
Usage
Sort imports on save by
isort_on_save
settings.Open
Command Panel
from menu or withctrl+shift+p
(Mac:cmd+shift+p
) and selectisorted: Format file
.Run
isort
on the current file with key bindings activated before:
Press ctrl+alt+s
(Mac: cmd+alt+s
) to sort imports in the entire file.
Issues
If there is something wrong with this plugin, add an issue on GitHub and I'll try to address it.
Thanks
This plugin is inspired by Sublime text isort plugin and sublack. Thanks to @thijsdezoete and @jgirardet.
Changelog
see CHANGELOG
Contributing
- Remove
isorted
viaPackage Control
. - Fork
isorted
- Clone your
isorted
fork to yourPackages
folder (Preferences
→Browse Packages
…). - Add your name to Authors in the readme.
Authors
Coded by Rim Valiulin @rimvaliulin.
Contributions: Stanley Chung @returnchung.
Todo
MacOS: Fix error 'You may need to install isort and/or configure 'isort_command' in isorted's settings.' on new Sublime Text startup after reboot (needs Sublime Text restart).
Add quick toggle
isort_on_save
for specific file.