如何处理 Vim 脚本中的错误?

ere*_*eOn 2 vim folding

在我的.vimrc文件,我有以下功能,这在折叠的一些顶级的许可信息.hpp.cpp文件:

" Skip license 
function! FoldLicense()
    if !exists("b:foldedLicense")
        let b:foldedLicense = 1
        1;/\*\//fold
    endif
endfunction

au BufRead *.hpp call FoldLicense()
au BufRead *.cpp call FoldLicense()
Run Code Online (Sandbox Code Playgroud)

这种运作良好,但如果我打开.cpp该文件具有任何许可的信息块,Vim的抱怨图案没有找到。很公平,但是有没有办法让他停止抱怨并且如果找不到模式就什么都不做?

谢谢 !

编辑:完整的解决方案(使用 Bryan Ross 的回答)

" Skip license 
function! FoldLicense()
    if !exists("b:foldedLicense")
        let b:foldedLicense = 1
        silent! 1;/\*\//fold
    endif
endfunction

au BufRead *.hpp call FoldLicense()
au BufRead *.cpp call FoldLicense()
Run Code Online (Sandbox Code Playgroud)

ros*_*dia 5

我相信这可能有效:

silent! 1;/\*\//fold
Run Code Online (Sandbox Code Playgroud)