The fact that you are getting this message on your verbose log file is expected.
The Vim source code has an explicit comment about that:
/*
* When using ":silent! cmd" ignore error messages.
* But do write it to the redirection file.
*/
I linked to the code in Vim 7.4, but Vim 8.2 still has the same exact snippet and exhibits the same behavior.
I assume this behavior exists because you'd enable verbosity and a redirect file when you're debugging an issue. In those circumstances, logging errors that would otherwise be silented can be quite helpful. Also, there's little harm in printing those messages, since they're not interrupting the user, but simply going to the verbose redirect file.
So it appears there is an error in ftoff.vim? If not, is there a better way to set filetype off than the filetype off
command?
I wouldn't call it a bug, since you're asking for debugging information and you're simply getting what you asked for. You're likely to get that from many more Vimscript snippets that are using :silent
and will have their silented errors logged if you run with verbose logging.
Furthermore, the implementation in ftoff.vim
will not print any errors (even to the redirected verbose file) if the filetypedetect
augroup was ever created (in other words, if filetype
was ever enabled.) Note that it doesn't really remove the augroup, it simply clears it, so disabling filetype repeatedly after ever enabling it will not really print errors (to the redirect file.)
You could argue it would have been best to check whether the augroup actually exists before trying to clear it, but arguably using :silent!
is a much shorter way to accomplish that and it doesn't really present significant drawbacks (perhaps having the error hit the verbose redirect log being a minor annoyance, at most.)