From 918592cdc63bab9f3a0f9e77638ea414eac326a4 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 29 Jul 2021 16:49:12 +0300 Subject: [PATCH] Add warning messages to deprecated function calls --- plugin/nerdcommenter.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin/nerdcommenter.vim b/plugin/nerdcommenter.vim index 13db9cc..0bc51eb 100644 --- a/plugin/nerdcommenter.vim +++ b/plugin/nerdcommenter.vim @@ -42,6 +42,7 @@ call s:InitVariable('g:NERDDefaultAlign', 'none') call s:InitVariable('g:NERDTrimTrailingWhitespace', 0) call s:InitVariable('g:NERDToggleCheckAllLines', 0) call s:InitVariable('g:NERDDisableTabsInBlockComm', 0) +call s:InitVariable('g:NERDSuppressWarnings', 0) " Section: Comment mapping and menu item setup " =========================================================================== @@ -100,14 +101,23 @@ call s:CreateMaps('', ':help NERDCommenterContents', 'Help', '') " Shim functions so old code gets passed through to the autoload functions function! NERDComment(mode, type) + if !g:NERDSuppressWarnings + echom "Function NERDComment() has been deprecated, please use nerdcommenter#Comment() instead" + endif return nerdcommenter#Comment(a:mode, a:type) endfunction function! NERDCommentIsLineCommented(lineNo) + if !g:NERDSuppressWarnings + echom "Function NERDCommentIsLineCommented() has been deprecated, please use nerdcommenter#IsLineCommented() instead" + endif return nerdcommenter#IsLineCommented(a:lineNo) endfunction function! NERDCommentIsCharCommented(line, col) + if !g:NERDSuppressWarnings + echom "Function NERDCommentIsCharCommented() has been deprecated, please use nerdcommenter#IsCharCommented() instead" + endif return nerdcommenter#IsCharCommented(a:line, a:col) endfunction