NealStephenson? said it best [In the Beginning...]
The existence of a command line is a key feature of powerful text editors.
Command lines are used in the ViFamily, EmacsFamily, IbmEditorFamily, and others.
Also most editors that do have a commandline have an escape, usually the bang ('!') that allows one to execute system commands. Thus giving the editor a basic Shell feature.
An alternative is the ability to "filter" a buffer of text with a command. That command could be either a built-in, a macro, or a Shell command. In VI, this is the '|' pipe character's function on the CommandLine.
For instance, editors in the IbmEditorFamily like ISPF/PDF, XEDIT, ICCF, THE, T, cse have an actual command line on the screen interface. Some editors, like Kate or X2, hide their command lines and provide a key sequence to make it visible. (XEDIT can be made to hide its command line.) Editors like Vi provide a means to execute a command in a sub-shell (via ":!command") but don't have a command line per se.
Editors with command lines, of course, also provide commands to be typed there. Many are simple: top, bottom, up, down, etc.; these are equivalent to ALT- or CTRL- key combinations used by other editors. More complicated commands like find and change are implemented in other editors with pop-up windows. When used one at a time there is little difference between command line commands and key-combination commands; the advantage for command line commands is that they can be chained together on the command line, either by separating them with a logical line-end character, or with a sort of cascading method; thus, in the X2 editor, after marking a block of lines, one may enter top^/string/^c/from/to/m* (where ^ is the logical line-end character), which does the following:
The XEDIT editor provides even more flexibility. The cascaded command locate -/firststring/ change /from/to/ /laststring/ 2¹ does the following:
¹The locate and change commands can be abbreviated and extraneous spaces can be omitted, so -/firststring/c/from/to//laststring/2 does the same thing. (The locate command is used so often that in locate /string/ the entire word locate can be omitted.)
XEDIT provides a powerful all macro which allows one to filter the displayed lines to just the ones of interest, e.g. all/string1/|/string2&¬/string3/, which says,
When combined with MacroLanguage capabilities (which usually require command line commands), very complicated editing routines can be built. Such capability allows the user to customize the editor to perform a standard sequence of operations on files; for example, something like the XEDIT command shown above can be extended with a RexxLanguage macro to perform the operation multiple times, e.g. until fromString is no longer found. This example searches forward instead of backward:
/* Simple EXAMPLE XEDIT */ signal on error /* Stop if RC (the return code from a command) is non-zero. */ 'top' /* Start from the top of the file. */
do forever /* Non-zero return code will terminate this loop. */ 'locate /firstString/' /* Find the next occurrance of firstString. */ /* change at most two occurrances of fromString to toString */ 'change /from/to/ /lastString/ 2' /* on each line from here until lastString is found. */ end
error: exit rc
The macro can also be written to accept arbitrary strings from the command line, to issue other commands between multiple loops, etc.
By contrast, shell escapes allow one to execute non-editor commands, and perhaps insert the results into the text being edited, but this is not quite the same as modifying the text using editor commands. --JLTurriff