A "script" does nothing more than run a sequence of ex commands. An "ex command" is what you type when you use
: in Vim. For example
:e file, etc. are all ex commands.
: is not part of the command; it is merely a keystroke to start the command-line mode; you don't always need to include the
:, for example when you chain multiple commands with
| you don't need to repeat the
: more than once. For example,
:write | quit will work fine.
For convenience, the
: may be included though. This aids with copy/pasting and such, but you don't have to. It doesn't matter. In fact, all leading
:s are simply ignored.
:::::::::write are all equivalent in terms of functionality (although obviously not in terms of sanity).
It's often useful to include the
: in documentation to clarify that this is an ex command. For example
w could refer either to
:w or the normal mode command
w to go to the next word.
Note that this applies to everything. Control structures such as
endif are also just ex commands; you can type something like this:
from the Vim commandline just fine; no need for a "script". Vim scripts are very "non-magic" and "non-special"; everything you can do from the ex commandline you can do in a Vim script, and vice versa.