Larry Alkoff wrote:
Tim Chase wrote:
I know every ex command starts with a colon.

Is the reverse true in every case?
Is _every_ command that starts with a colon an ex command?

Examples
:help        Is this an ex command?
:version    Is this?
:blahblah    This?

My understanding is that _yes_, typing the colon temporarily
enters "ex" mode for one command.  To try things out, you can use
"Q" to enter actual "ex" mode (use "vi" to re-enter visual mode).

There may be some caveats, such as in general, one can do

    :g/regexp/ex-command

However, while ":g" is an ex command, it can't be nested within
an outer ":g" command (as noted in the help).

There may be a distinction between "what vim treats as 'ex' mode"
and "what classic vi/ex supports", but this might be changeable
by the 'cp' option to ensure compatibility with old vi/ex.

Pretty much any command you can use in ex mode, one can also use
in scripts (and vice-versa) which makes for some very powerful
vim-script actions.

With further information about what you're trying to do, it might
shed light on small nuances of difference, but for the most part,
one can assume that if it starts with a colon, it's an ex command.

-tim



Thanks Tim, Yakov and Martin.
I'll just ASSume from now on that, if it starts with a colon,
it may as be an ex command.
Very interesting information on the use of ex.

Larry


Vhat Vim calls "ex-commands" are prefixed by a colon when typed at the command-line (the colon is actually used to go from Normal mode to Command-line mode). There are more of them than what was originally valid in the "ex" program; and you can even define your own (using the ":command" command).

In scripts, or after another command like ":vertical", ":botright", ":browse", ":verbose", ":autocommand EventName *", etc., the colon is not necessary: e.g.

        :vert split foobar.txt
        :bot help pattern-overview
        :verbose set guifont?
        :browse edit
        :au VimLeave * set verbose=0
        :if has("gui_running") | set lines=9999 columns=9999 | endif

The commands

        split foobar.txt
        help pattern-overview
        set guifont?
        edit
        set verbose=0
        set lines=9999 columns=9999
        endif

are ex-commands, which don't need a colon because there is something before them on the same command-line. (Note that ":if" and ":endif", when typed at the command-line, should be on the same line as above)


Best regards,
Tony.
--
Watson's Law:
        The reliability of machinery is inversely proportional to the
number and significance of any persons watching it.

Reply via email to