Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

- 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
- Vim: Warn on unsupported Vim and Python versions independently (#4772)
- Vim: Print the import paths when importing black fails (#4675)
- Vim: Fix handling of virtualenvs that have a different Python version (#4675)

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