From 975baf501f49cb2cba177e46045c0b7a42758b94 Mon Sep 17 00:00:00 2001 From: Sedat Date: Mon, 23 Mar 2026 21:27:38 +1100 Subject: [PATCH 1/4] docs: add Neovim integration guide and fix http link - Add a dedicated Neovim section to the editor integrations docs, covering three approaches: - conform.nvim (recommended, with format-on-save example) - ALE (cross-reference to existing Vim section) - Simple :!black % command with a Lua user command example - Fix http://python-requests.org/ link to use https:// Fixes #3960 --- docs/index.md | 2 +- docs/integrations/editors.md | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index ef0ce7c8996..a085b97259b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -56,7 +56,7 @@ Twisted and CPython: > _At least the name is good._ -**Kenneth Reitz**, creator of [requests](http://python-requests.org/) and +**Kenneth Reitz**, creator of [requests](https://python-requests.org/) and [pipenv](https://docs.pipenv.org/): > _This vastly improves the formatting of our code. Thanks a ton!_ diff --git a/docs/integrations/editors.md b/docs/integrations/editors.md index 3f5a99933a6..febf034e8bb 100644 --- a/docs/integrations/editors.md +++ b/docs/integrations/editors.md @@ -353,6 +353,67 @@ nnoremap :Black let g:ale_fixers.python = ['black'] ``` +## Neovim + +### Via conform.nvim + +[conform.nvim](https://github.com/stevearc/conform.nvim) is a lightweight formatter +plugin for Neovim. It supports _Black_ out of the box as long as `black` is available +in your `PATH`. + +1. Install `black` (e.g. `pip install black` or `pipx install black`) + +1. Install `conform.nvim` using your plugin manager and add the following to your Neovim + configuration: + + ```lua + require("conform").setup({ + formatters_by_ft = { + python = { "black" }, + }, + }) + ``` + +1. To format on save, add: + + ```lua + require("conform").setup({ + formatters_by_ft = { + python = { "black" }, + }, + format_on_save = { + timeout_ms = 500, + lsp_format = "fallback", + }, + }) + ``` + +### With ALE + +[ALE](https://github.com/dense-analysis/ale) supports both Vim and Neovim. See the +[Vim section](#with-ale) above for setup instructions — the same configuration works +for Neovim. + +### Simple command + +You can invoke _Black_ on the current file directly from Neovim without any plugins: + +```vim +:!black % +``` + +To create a convenient `:Black` command, add this to your `init.lua`: + +```lua +vim.api.nvim_create_user_command( + "Black", + function() + vim.cmd("!black " .. vim.fn.expand("%")) + end, + { nargs = 0 } +) +``` + ## Gedit gedit is the default text editor of the GNOME, Unix like Operating Systems. Open gedit From 2c4c3837392510b6f5afcad0b6e9253ce56a9688 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 10:28:27 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/integrations/editors.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/integrations/editors.md b/docs/integrations/editors.md index febf034e8bb..beb8f3a9721 100644 --- a/docs/integrations/editors.md +++ b/docs/integrations/editors.md @@ -358,8 +358,8 @@ nnoremap :Black ### Via conform.nvim [conform.nvim](https://github.com/stevearc/conform.nvim) is a lightweight formatter -plugin for Neovim. It supports _Black_ out of the box as long as `black` is available -in your `PATH`. +plugin for Neovim. It supports _Black_ out of the box as long as `black` is available in +your `PATH`. 1. Install `black` (e.g. `pip install black` or `pipx install black`) @@ -391,8 +391,8 @@ in your `PATH`. ### With ALE [ALE](https://github.com/dense-analysis/ale) supports both Vim and Neovim. See the -[Vim section](#with-ale) above for setup instructions — the same configuration works -for Neovim. +[Vim section](#with-ale) above for setup instructions — the same configuration works for +Neovim. ### Simple command From 5f77ecbdd8b0789fb31cbcbf79f3ea4face94203 Mon Sep 17 00:00:00 2001 From: Sedat Date: Mon, 30 Mar 2026 21:14:43 +1100 Subject: [PATCH 3/4] docs: add changelog entry for Neovim integration guide Co-Authored-By: Claude Sonnet 4.6 --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index b326a0139d1..886e1612392 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -53,6 +53,8 @@ +- Add Neovim integration guide covering conform.nvim, ALE, and simple command approaches (#5061) + ## 26.3.1 ### Stable style From 43d5d640ff0bc96c4a191cdf8a97a290f87517ce Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 12:28:35 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c9237c66136..044ce89dd97 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -53,7 +53,8 @@ -- Add Neovim integration guide covering conform.nvim, ALE, and simple command approaches (#5061) +- Add Neovim integration guide covering conform.nvim, ALE, and simple command approaches + (#5061) - Use "Version X.Y.Z" headings in changelog for stable permalink anchors on ReadTheDocs (#5063)