14

There are two vim Ex modes:

  • the vi compatible Ex-mode (vim -e -s),
  • vim improved Ex mode (vim -E -s).

Vim improved Ex mode allows for more advanced commands than the vi compatible Ex-mode, however what are the main differences? Or where I can find them?

1 Answer 1

17

This is actually documented in a somewhat 'hidden' non-obvious way, from :help Ex-mode

Q                       Switch to "Ex" mode.  This is a bit like typing ":"
                        commands one after another, except:
                        - You don't have to keep pressing ":".
                        - The screen doesn't get updated after each command.
                        - There is no normal command-line editing.
                        - Mappings and abbreviations are not used.
                        In fact, you are editing the lines with the "standard"
                        line-input editing commands (<Del> or <BS> to erase,
                        CTRL-U to kill the whole line).
                        Vim will enter this mode by default if it's invoked as
                        "ex" on the command-line.
                        Use the ":vi" command :visual to exit "Ex" mode.
                        Note: In older versions of Vim "Q" formatted text,
                        that is now done with gq.  But if you use the
                        vimrc_example.vim script "Q" works like "gq".

                                        gQ
gQ                      Switch to "Ex" mode like with "Q", but really behave
                        like typing ":" commands after another.  All command
                        line editing, completion etc. is available.
                        Use the ":vi" command :visual to exit "Ex" mode.
                        {not in Vi}

The first paragraph (Q) documents ex mode (-e), and the second one documents the improved ex mode (-E).

With ex mode (-e), Vim tries to "emulate" Ex as much as possible, and a number of Vim improvements won't work (such as mappings, user-defined functions, line editing).

With improved ex mode (-E), Vim "really behaves like typing ":" commands after another".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.