This question on StackOverflow triggered my curiosity.
What does :silent !echo
doing?
The first time I saw something like :excommand !shellcommand
was when I was looking for a way to save a read-only file from within a non-sudo
Vim session. Indeed I found the famous How does the vim “write with sudo” trick work?. In that case, however, it's "easy" to search for :help :w
and scroll down a bit find the entry :[range]w[rite] [++opt] !{cmd}
which describes the meaning of that !
.
In the case of :silent
, instead, doing :help :silent
doesn't bring anywhere the question mark is used after a space and before {command}
.
My understanding is that :silent !echo
is working mostly like :!echo
but without showing any of the output or of the underlying shell, and sending the cursor to the top of the screen. I've recorded a screencast for reference. (NOTE: All those horizontal lines that you see happen to be present only in the screencast, for some reason, there's no such a thing in my system.)
This question seems related.