`:help change.txt` mentions 2- or 3- letter :substitute commands, such as `:sg`, `:sgn` and so on. I am guessing that these `:s[xx]` correspond to flags, but am not sure how to use them. 

For example, I would think that `:%sg/foo/bar` would substitute all matches of `foo`, including multiple occurences on the same line. However, that commands gives me an error --- "trailing characters".

What is the appropriate syntax for `:s[x[x]]`?