Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
- Enhance GitHub Action `psf/black` to support the `required-version` major-version-only
"stability" format when using pyproject.toml (#4770)

- Improve error message for vim plugin users. It now handles independently vim version
and python support missing (#4437)

### Documentation

<!-- Major changes to documentation and policies. Small docs changes
Expand Down
19 changes: 14 additions & 5 deletions plugin/black.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,21 @@ if exists("g:load_black")
endif

if v:version < 700 || !has('python3')
func! __BLACK_MISSING()
echo "The black.vim plugin requires vim7.0+ with Python 3.9 support."
func! __ERROR()
let messages = []

if v:version < 700
call add(messages, "vim7.0+")
endif
if !has('python3')
call add(messages, "Python 3.9 support")
endif

echo "The black.vim plugin requires" join(messages, " and ")
endfunc
command! Black :call __BLACK_MISSING()
command! BlackUpgrade :call __BLACK_MISSING()
command! BlackVersion :call __BLACK_MISSING()
command! Black :call __ERROR()
command! BlackUpgrade :call __ERROR()
command! BlackVersion :call __ERROR()
finish
endif

Expand Down