In Vim7, the :s command added a "n" flag to not actually perform
the substitute, but just report the number of changes made.
However, it seems that if 'modifiable' is off, one can't do
something like
:%s/foo/bar/gn
to count items in the non-modifiable file, as it gives
"E21: Cannot make changes, 'modifiable' is off"
which seems a bit counter-intuitive, as one's not actually making
changes.
[n] Report the number of matches, do not actually substitute.
I don't know if this qualifies as a bug (if nomodifiable is set,
a :s/foo/bar/n[g] command should be allowed), a pecularity, or
"desired" behavior, but I didn't see anything in the docs for
s_flags about the matter one way or the other.
-tim