X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/3be0aa71d9e39a8fdb6f38cc796709bf4f9c11d9..b332cfa655dedfeb74974abdac1fb7b55d7e62ea:/docs/editor_integration.md?ds=inline diff --git a/docs/editor_integration.md b/docs/editor_integration.md index 21a6865..ae24c76 100644 --- a/docs/editor_integration.md +++ b/docs/editor_integration.md @@ -111,6 +111,8 @@ $ black --help ## Vim +### Official plugin + Commands and shortcuts: - `:Black` to format the entire file (ranges not supported); @@ -123,6 +125,7 @@ Configuration: - `g:black_linelength` (defaults to `88`) - `g:black_skip_string_normalization` (defaults to `0`) - `g:black_virtualenv` (defaults to `~/.vim/black` or `~/.local/share/nvim/black`) +- `g:black_quiet` (defaults to `0`) To install with [vim-plug](https://github.com/junegunn/vim-plug): @@ -232,6 +235,47 @@ If you later want to update _Black_, you should do it like this: $ 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 +as + +```console +$ gedit +``` + +1. `Go to edit > preferences > plugins` +2. Search for `external tools` and activate it. +3. In `Tools menu -> Manage external tools` +4. Add a new tool using `+` button. +5. Copy the below content to the code window. + +```console +#!/bin/bash +Name=$GEDIT_CURRENT_DOCUMENT_NAME +black $Name +``` + +- Set a keyboard shortcut if you like, Ex. `ctrl-B` +- Save: `Nothing` +- Input: `Nothing` +- Output: `Display in bottom pane` if you like. +- Change the name of the tool if you like. + +Use your keyboard shortcut or `Tools -> External Tools` to use your new tool. When you +close and reopen your File, _Black_ will be done with its job. + ## Visual Studio Code Use the @@ -255,7 +299,8 @@ Sublime Text, Visual Studio Code and many more), you can use the ## Atom/Nuclide -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)