ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

sublack

by jgirardet ST3

Black integration in SublimeText

Details

  • 1.12.0
  • github.​com
  • github.​com
  • 4 weeks ago
  • 41 minutes ago
  • 3 months ago

Installs

  • Total 503
  • Win 106
  • OS X 256
  • Linux 141
Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4
Windows 0 1 2 0 2 1 1 3 4 4 1 0 0 2 0 2 3 1 0 5 1 0 2 1 1 3 2 0 1 3 3 1 0 2 1 1 4 0 0 2 3 0 0 0 2 1
OS X 0 3 4 10 5 10 4 0 7 0 3 9 3 3 2 2 3 4 11 7 8 2 4 6 6 2 5 1 0 9 4 1 2 4 1 1 4 3 1 6 7 2 2 3 1 4
Linux 0 4 3 2 0 1 1 1 3 2 6 0 1 3 0 1 2 2 2 2 1 3 2 2 2 1 3 0 1 3 4 2 3 4 1 1 1 4 5 4 2 2 5 3 3 1

Readme

Source
raw.​githubusercontent.​com
/readmes/img/83e009b6139b4e15b8734f5e9b24c0891f5ae44c.svg /readmes/img/9c24e3c6721e16f48702503d6759873a061495e1.svg

sublack

Black integration for SublimeText

Usage

  • Run Black on current file:

    Press Ctrl-Alt-B to format the entire file. You can also Ctrl-Shift-P (Mac: Cmd-Shift-P) and select Sublack: Format file.

  • Run Black with --diff:

    Press Ctrl-Alt-Shift-B will show diff in a new tab. You can also Ctrl-Shift-P (Mac: Cmd-Shift-P) and select Sublack: Diff file.

  • Toggle Black on save for current view :

    Press Ctrl-Shift-P (Mac: Cmd-Shift-P) and select Sublack: Toggle black on save for current view.

Installation

  1. Install Black (if you haven't already):

    pip install black # Requires python 3.6
    
  2. In PackageControl just find sublack, and that's it !

or

Without PackageControl install manually by navigating to Sublime's Packages folder and cloning this repository:

git clone https://github.com/jgirardet/sublack.git

Settings

Global settings

Preferences -> Package Settings -> sublack -> settings :

Black specifics options

  • black_line_length:

    Set custom line length option used by Black. Default = null which lets black default.

  • black_fast:

    Black fast mode. default is false.

  • black_skip_string_normalization:

    Don't normalize string quotes or prefixes. Default = false.

  • black_exclude:

    Regex matching excluded path. Default is Black's default.

  • black_include:

    Regex matching included path. Default is Black's default.

  • black_py36:

    Force use of python 3.6 only syntax. Default is Black-s default.

Sublack specifics options

  • black_command:

    Set custom location. Default = "black".

  • black_on_save:

    Black is always run before saving file. Default = false.

  • black_debug_on:

    Show non error messages in console. Default = false. Error messages are always shown in console.

  • black_default_encoding:

    Should not be changed. Only needed on some OSX platforms.

Project settings

Just add sublack as prefix (recommended):

{
"settings":{
    "sublack.black_on_save": true
    }
}

A sublack subsettings is still possible:

{
"settings":{
    "sublack":{
            "black_on_save": true
            }
    }
}

pyproject.toml settings

sublack support use of black configuration in pyproject.toml. Be aware that global/project settings will override pyproject.toml's settings. See black about pyproject.toml .

Sublime Linter integration

You can install SublimeLinter-addon-black-for-flake. The plugin will auto configure flake8 and mute all warnings black can actually fix.

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 very inspired by the very good PyYapf Plugin. Thanks to Jason Kane.

Changelog

see install.txt

Contributing

  • remove sublack via Package Control.
  • fork sublack
  • clone your sublack fork to your Packages folder (Preferences --> Browse Packages...).
  • install UnitTesting in Package Control
  • adding a test for new features or bugfix is really nice if you can.
  • add your name to Authors in readme.

Authors

Laboriously coded by Jimmy Girardet

contributions by: