Previous: Emacs gid interface, Up: lid invocation


5.3 eid: Invoking an Editor on Query Results

lid -R edit’ is an editing interface for the ID utilities that is most commonly used with vi. Emacs users should use the interface defined in idutils.el (see Emacs gid interface). The ID utilities include an alias called eid, and for the sake of brevity, we'll use this alias for the remainder of this section. eid performs a lid-style, then asks if you wish to edit the files. If your query yields more than one line of output, you will be prompted after each line. This is the prompt you'll see:

     Edit? [y1-9^S/nq]

You may respond with:

y
Edit all files listed.
1...9
Edit all files starting at the n + 1'st file.
/string or CTRL-Sregexp
Search into the file list, and begin editing with the first file name that matches the regular expression regexp.
n
Don't edit any files. If another line of query output is pending, advance to that line, for which another ‘Edit?’ prompt will appear.
q
Quit—don't edit any files, and don't process any more lines of query output.

Here is an example:

     prompt$ eid FILE \^print
     FILE           {ansi2knr,fid,filenames,idfile,idx,lid,misc,...}.c
     Edit? [y1-9^S/nq] n
     ^print         {ansi2knr,fid,getopt,getopt1,lid,mkid,regex,scanners}.c
     Edit? [y1-9^S/nq] 2

This will start editing at getopt.c.

eid invokes the editor defined by the environment variable ‘VISUAL’. If ‘VISUAL’ is undefined, it uses the environment variable ‘EDITOR’ instead. If ‘EDITOR’ is undefined, it defaults to vi. It is possible for eid to pass the editor an initial search pattern so that your cursor will immediately alight on the token of interest. This feature is controlled by the following environment variables:

EIDARG
A printf(3) format string for the editor argument to search for the matching token. For vi, this should be ‘+/%s/’.
EIDLDEL
The regular-expression meta-character(s) for delimiting the beginning of a word (the `eid Left DELimiter'). eid inserts this in front of the matching token when a word-search is desired. For vi, this should be ‘\<’.
EIDRDEL
The regular-expression meta-character(s) for delimiting the end of a word (the `eid Right DELimiter'). eid inserts this in end of the matching token when a word-search is desired. For vi, this should be ‘\>’.