From bbe5ae70c17ff16801fef240f49b707535c7f64c Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Tue, 3 Mar 2020 07:00:52 -0500 Subject: [PATCH] Notify users of missing Python lazily (#1210) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- plugin/black.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/black.vim b/plugin/black.vim index a4047d4..8106ea1 100644 --- a/plugin/black.vim +++ b/plugin/black.vim @@ -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 -- 2.39.5