Frequently Asked Question
What is ex mode and why does Vim have it?
Ex is the line editor Vim is built on top of. vi was originally written
by Bill Joy in 1976 as a visual mode for the older ex editor, which
was itself a successor to ed. The lineage shows: every command you
type after a colon in Vim, :w, :s/foo/bar/, :g/error/d, :5,10 delete, is an ex command, executed by the line-editing layer beneath
the visual interface. The colon prompt at the bottom of the screen is
the ex command line.
Vim also has a separate mode called Ex mode proper, entered with Q
from normal mode (in classic Vim) or by running the editor as ex. It
drops the screen-oriented view entirely and gives you a teletype-style
prompt where each line is one ex command. This is essentially never
useful interactively in 2026, and Neovim disabled Q by default for
that reason. You leave with :visual to return to the normal screen
editor.
The legacy is worth understanding for two reasons. Scripts that drive
Vim non-interactively (vim -e -c 'commands' file) use ex mode under
the hood. And the design, a small set of operators and motions
composed into a grammar, descends directly from ex's line-range syntax
(5,10delete, g/pat/d), which dates back to ed in the early 1970s.
Half a century later, the same grammar still works.