]>
git.madduck.net Git - etc/vim.git/blobdiff - docs/editor_integration.md
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
-```console
-$ pip install black
-```
+ ```console
+ $ pip install black
+ ```
2. Locate your `black` installation folder.
2. Locate your `black` installation folder.
+ On macOS / Linux / BSD:
-```console
-$ which black
-/usr/local/bin/black # possible location
-```
+ ```console
+ $ which black
+ /usr/local/bin/black # possible location
+ ```
-```console
-$ where black
-%LocalAppData%\Programs\Python\Python36-32\Scripts\black.exe # possible location
-```
+ ```console
+ $ where black
+ %LocalAppData%\Programs\Python\Python36-32\Scripts\black.exe # possible location
+ ```
-Note that if you are using a virtual environment detected by PyCharm, this is an
-unneeded step. In this case the path to `black` is `$PyInterpreterDirectory$/black`.
+ Note that if you are using a virtual environment detected by PyCharm, this is an
+ unneeded step. In this case the path to `black` is `$PyInterpreterDirectory$/black`.
3. Open External tools in PyCharm/IntelliJ IDEA
3. Open External tools in PyCharm/IntelliJ IDEA
-`PyCharm -> Preferences -> Tools -> External Tools`
+ `PyCharm -> Preferences -> Tools -> External Tools`
-On Windows / Linux / BSD:
+ On Windows / Linux / BSD:
-`File -> Settings -> Tools -> External Tools`
+ `File -> Settings -> Tools -> External Tools`
4. Click the + icon to add a new external tool with the following values:
4. Click the + icon to add a new external tool with the following values:
-```console
-$ pip install black
-```
+ ```console
+ $ pip install black
+ ```
2. Make sure it runs from the command line, e.g.
2. Make sure it runs from the command line, e.g.
-```console
-$ black --help
-```
+ ```console
+ $ black --help
+ ```
3. In Wing IDE, activate the **OS Commands** panel and define the command **black** to
execute black on the currently selected file:
3. In Wing IDE, activate the **OS Commands** panel and define the command **black** to
execute black on the currently selected file:
-- Use the Tools -> OS Commands menu selection
-- click on **+** in **OS Commands** -> New: Command line..
- - Title: black
- - Command Line: black %s
- - I/O Encoding: Use Default
- - Key Binding: F1
- - [x] Raise OS Commands when executed
- - [x] Auto-save files before execution
- - [x] Line mode
+ - Use the Tools -> OS Commands menu selection
+ - click on **+** in **OS Commands** -> New: Command line..
+ - Title: black
+ - Command Line: black %s
+ - I/O Encoding: Use Default
+ - Key Binding: F1
+ - [x] Raise OS Commands when executed
+ - [x] Auto-save files before execution
+ - [x] Line mode
4. Select a file in the editor and press **F1** , or whatever key binding you selected
in step 3, to reformat the file.
## Vim
4. Select a file in the editor and press **F1** , or whatever key binding you selected
in step 3, to reformat the file.
## Vim
Commands and shortcuts:
- `:Black` to format the entire file (ranges not supported);
Commands and shortcuts:
- `:Black` to format the entire file (ranges not supported);
$ pip install -U black --no-binary regex,typed-ast
```
$ pip install -U black --no-binary regex,typed-ast
```
+### With ALE
+
+1. Install [`ale`](https://github.com/dense-analysis/ale)
+2. Install `black`
+3. Add this to your vimrc:
+
+ ```vim
+ let g:ale_fixers = {}
+ let g:ale_fixers.python = ['black']
+ ```
+
## Gedit
gedit is the default text editor of the GNOME, Unix like Operating Systems. Open gedit
## Gedit
gedit is the default text editor of the GNOME, Unix like Operating Systems. Open gedit
-Use [python-black](https://atom.io/packages/python-black).
+Use [python-black](https://atom.io/packages/python-black) or
+[formatters-python](https://atom.io/packages/formatters-python).
## Gradle (the build tool)
## Gradle (the build tool)