4.7 Editing Source files (‘edit’)

To edit the lines in a source file, use the edit command. The editing program of your choice is invoked with the current line set to the active line in the program. Alternatively, you can give a line specification to specify what part of the file you want to print if you want to see other parts of the program.

You can customize to use any editor you want by using the EDITOR environment variable. The only restriction is that your editor (say ex), recognizes the following command-line syntax:

ex +number file

The optional numeric value +number specifies the number of the line in the file where to start editing. For example, to configure the BASH debugger to use the vi editor, you could use these commands with the sh shell:

EDITOR=/usr/bin/vi
export EDITOR
gdb ...

or in the csh shell,

setenv EDITOR /usr/bin/vi
gdb ...
edit [line specification]

Edit line specification using the editor specified by the EDITOR environment variable.