Programming Assistance
elvis’s programming assistance capabilities are described in this section.
Edit-Compile Speedup
elvis provides commands that make it easier to stay within the editor while working on a program. You can recompile a single file, rebuild your entire program, and work through compiler errors one at a time. The elvis commands are summarized in Table 17-10.
| Command | Option | Function |
cc[!]
[args] | ccprg | Run the C compiler. Useful for recompiling an individual file. |
mak[e][!]
[args] | makeprg | Recompile everything that needs recompiling (usually via make). |
er[rlist][!]
[file] | Move to the next error’s location. |
The cc command recompiles
an individual source file. You run it from the colon command line.
For example, if you are editing the file hello.c and you type :cc, elvis will compile hello.c for you.
If you supply additional arguments to the :cc command, those arguments will be
passed on to the C compiler. In this case, you need to supply
all the arguments, including the
filename.
The :cc command works by
executing the text of the ccprg
option. The default value is "cc
($1?$1:$2)". elvis sets
$2 to the name of the current
source file, and $1 to the
arguments you give to the :cc
command. The value of ccprg thus
uses your arguments if they are present; otherwise, it just passes
the current file’s name to the system cc command. (You can, of course, change
ccprg to suit your taste.)
Similarly, the :make command is intended to recompile everything ...