CFOG's PIP, November 1986, Volume 5 No. 1, Whole No. 49, page 5
Recalling and Editing The Command Line -- A CP/M + Extra
by Benjamin H. Cohen
Who hasn't typed the command:
ren newname.ext=oldname.ext
only to receive the message from CP/M:
NO FILE
OLDNAME.EXT?
because you misspelled oldname.ext? I admit I seldom use the REN command, because I use NSWP to rename files. But occasionally all I want to do is rename a file, then run NewWord, or MEX, or whatever. So, out comes REN. Darn, another typo in the command line!
When I got my Executive, I read about command line editing, but skimmed over the section because it seemed too painful to learn another set of editing commands. Recently, I tried some experimenting, and, well, it's really rather simple. Since this is a CP/M+ feature it should work on other computers with that operating system, such as the Commodore 128 and Morrow systems that have CP/M+, among others.
To restore the last command line simply hit ^W. Then I move the cursor using ^A to move it left and ^F to move it right -- shades of WordStar, but only one character at a time -- and ^G or ^H to delete the character at the cursor or to the left, respectively. Insertions are simply typed in: command line editing is done in "insert mode". So, a few minutes ago, when I entered:
ren rb.lbl=labels--4.rb<cr>
and CP/M rudely responded:
No File
I simply hit ^W and edited out the extra hyphen in my command line.
I discovered another feature of command line editing while using NeWSweeP. I was copying a disk label file from one of my disks to a batch of new disks that had no labels. On my Osborne 1 I always used Smartkey to define a key as "save 0 b:-disknam.0" and then struck the key, added the required digits, and hit the <cr>. That won't work on the Exec, since the SAVE command won't allow you to create an empty [0K] file. So I resorted to using NSWP. With the cursor next to the name of the empty file, I entered
c b:-disknam.nnn<cr>".
I changed the disk in Drive B: and hit "C^W", and lo and behold! The previous command line came back! I then hit ^H to delete the last digit, changed it, and hit the <cr>. So, if you are using NSWP and are prompted for a filename, hitting ^W will restore the last command line!
An added feature is also available if you use the 'history' RSX available in Hist+.Ibr. Like any resident extension this one steals some of your computer's TPA <transient program area>, but if you do a lot of entering of commands as distinguished from spending your time in a word processing program or spreadsheet all day you'll probably find it worthwhile. Hist+ keeps track of the commands you enter on the CP/M command line and allows you to list them on the screen <^L> and recall them in reverse order <keep hitting ^W; to move forward in the list you hit ^V>. You can edit the command lines just like 'real' command lines. Try it out on CFOG's #2 RCPM!