Skip to content

Commit

Permalink
Notify users of missing Python lazily (#1210)
Browse files Browse the repository at this point in the history
Currently this message shows up with no context prior to the start of
Vim. By changing this to a lazy message, the user will only be notified
of a problem with the Black plugin when they are attempting to use the
Black plugin.

Co-authored-by: Łukasz Langa <[email protected]>
  • Loading branch information
pganssle and ambv authored Mar 3, 2020
1 parent 8fef74c commit bbe5ae7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugin/black.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
" - restore cursor/window position after formatting

if v:version < 700 || !has('python3')
echo "The black.vim plugin requires vim7.0+ with Python 3.6 support."
func! __BLACK_MISSING()
echo "The black.vim plugin requires vim7.0+ with Python 3.6 support."
endfunc
command! Black :call __BLACK_MISSING()
command! BlackUpgrade :call __BLACK_MISSING()
command! BlackVersion :call __BLACK_MISSING()
finish
endif

Expand Down

0 comments on commit bbe5ae7

Please sign in to comment.