Eric Van Dewoestine wrote:
Should prepending :silent to a command be suppressing an autocommand?
Neither the docs for autocommands nor the docs for :silent indicate
this is the intended behavior.
For example:
using the following the autocommand is executed as expected with the
desired output
vim -u NONE -c "set nocompatible | set verbose=10 | autocmd
BufWinEnter test_file echom 'Test file opened.'" -c "edit test_file"
however, after adding :silent, the autocommand does not fire and there
is no output
vim -u NONE -c "set nocompatible | set verbose=10 | autocmd
BufWinEnter test_file echom 'Test file opened.'" -c "silent edit
test_file"
The purpose of ":silent" is to suppress output to the display, to
sysout/syserr and to the message history. What it does _not_ suppress is
output by ":redir" or (for version 7) logging to a 'verbosefile'. Try
(vim 7 only):
vim -N -u NONE -c "set verbosefile=vim.log" -c "au BufWinEnter
test_file echom 'Test file opened.'" -c "silent e test_file" -c q
(all on one line) followed (on Unix) by
cat vim.log
or (on Windows) by
type vim.log
If it displays "Test file opened.", then the autocommand _has_ fired;
but ":silent" has suppress all its output except to the verbosefile.
Best regards,
Tony.