next up previous contents index
Next: The listing Command Up: Input and Output Commands Previous: The dumpnodes Command   Contents   Index


The edit Command

The edit command allows the text of an input file to be edited.

edit [-n][-r] [filename]
The command will bring up a text editor loaded with the named file. If no file name is given, the file associated with the current circuit will be edited. If no file is associated with the current circuit, the current circuit will be printed into a temporary file which is opened for editing. If no circuits are present, an empty file is opened for editing. Pressing the Text Editor button in the Edit menu of the Tool Control window is equivalent to giving the edit command without arguments.

It should be noted that one can also provide input to WRspice> from an arbitrary text editor by ``saving'' the file to the active fifo file (see 3.15.11) that WRspice creates in the user's home directory. This is a special file the contains a port into WRspice, whereby data written to the fifo appear in WRspice as if sourced from a regular file (if WRspice is busy, the fifo write will block until WRspice is ready).

The editor used is named by the editor variable, the SPICE_EDITOR environment variable, or the EDITOR environment variable, in that order. If none of these is set, or the first one found is set to ``xeditor'', the internal editor is used, if graphics is available. If graphics is not available and no editor is specified, WRspice will attempt to use the ``vi'' editor. The internal editor has the advantage of asynchronous deck sources with the edit window displayed at all times, through the Source button in the editor's Options menu. The xeditor command is similar to the edit command, but will always call the internal editor. See 4.5.13 for a description of the internal editor.

If an external editor is used, if graphics is available the default action is to start the editor in a new xterm window. This can be suppressed if the noeditwin variable is set. This variable should be set if the external editor creates its own window to avoid the unneeded xterm. It can also be set for an editor such as vi, in which case the editing will take place in the same window used to interact with WRspice.

The -r and -n options are available only when the internal editor is not being used, and the editor is a text-mode editor such as vi and noeditwin is set so that editing takes place in the console controlling WRspice. If this is the case, after quitting the editor, the file will be sourced automatically if the text was saved. The -n (no source) option prevents this, and should be given if the editor is used to browse files that are not SPICE input files. The -r (reuse) option will reuse the existing circuit for the automatic source, rather than creating a new one. This saves memory, but prevents revisiting earlier revisions of the circuit. If the internal editor, or any editor that creates its own window is used, WRspice will pop up the editor and resume command prompting. There is no automatic source in this case.


next up previous contents index
Next: The listing Command Up: Input and Output Commands Previous: The dumpnodes Command   Contents   Index
Stephen R. Whiteley 2024-10-26