spec

Software for Diffraction

2.3.10. - Command Recall (History)



The basic spec history feature lets you recall previous commands. ( spec is usually installed with the optional BSD libedit history library. With the libedit library, the history syntax is greatly expanded. In addition, features such as command-line editing, and command completion become available. See the on-line .pdfhref W -D http://certif.com/spec_help/libedit.html libedit help file for detailed information. ) Examples of the recognized syntax are:
 !!   Redo the previous command. 
 !14   Redo command number 14. 
 !-2   Redo the second to previous command. 
 !asc   Redo the last command that began with asc
 !asc -10000   As above and append -10000 to the command. 
  
 history   List the last 1000 commands. 
 history N   List the last N commands. 
 history -N   List the last N commands in reverse order. 

The command number is prepended to the spec prompt as an aid in using the history feature. Only commands typed at the keyboard are remembered for history. By default, the previous 1000 commands are retained. The number of remembered commands can be changed using the spec_par() "history_size" option. See spec_par() 2.4.1.2 The history feature cannot be used in command files.

With the basic history feature, command recall must occur at the beginning of a line, although initial white space is allowed. Text may follow the command-recall word to extend that command.

Appending :s/left/right/ to a recalled command will modify the first occurrence of the string left in the recalled command to the characters right. The delimiter of the left and right strings may be any character. The final delimiter is optional. If left is empty, the last entered left string is used as the pattern to match.

In addition, ^left^right^ at the start of a line is shorthand for !-1:s/left/right/. In this case, the circumflex ( ^) must be used as the delimiter. The final delimiter is optional.

The history is saved along side the state file when exiting spec. Restarting spec reads in the saved history.