[alt.sources] Vi/Ex: command line editor? - Sort of.

rudy@alias.UUCP (Rudy Wortel) (03/08/91)

In article <5104@lure.latrobe.edu.au> ECSGRT@lure.latrobe.edu.au (GEOFFREY TOBIN, ELECTRONIC ENGINEERING) writes:
>  :.,.+3s/some long expression/another long expression/g...
>    OOPS!  I mistyped something.
>  :BORING REPETITION WITH A ONE-CHARACTER CORRECTION
>Command line editing for ex?

Having done this same thing 5000 times my solution was to never type
long : command at the command line. Instead i type them into the file
where you get all your favorite editing features. i then delete the
line into a named buffer and then execture the buffer with the @
command. To speed things up i have a macro for control X in my .exrc
file the does the delete and execute for me. If the command didn't
behave as expected then i undo the change put the buffer, edit and
reexecute it. It works adequately for me.

Here is my macro. It uses the named buffer 'd'

map ^X "ddd@d

As an aside you can exploit the function key maping to extend your
macro set. VI lets you type #<digit> to simulate pressing a function
key. The versions of vi i use don't check to make sure that the
characters following the # are digits. i have many macros defined as
#<letter> so that at last count i had 43 macros defined.

-rudy