start page | rating of books | rating of authors | reviews | copyrights

Book HomeLearning the vi EditorSearch this book

10.4. Initialization

This section describes elvis's session files and itemizes the steps it takes during initialization.

10.4.1. The Session File

elvis is intended to eventually meet COSE (Common Open System Environment) standards. These require that programs be able to save their state and return to that saved state at a later time.

To be able to do this, elvis maintains all its state in a session file. Normally elvis creates the session file when it starts, and removes it when it exits, but if elvis crashes, a left-over session file can be used to implement recovery of the edited files.

10.4.2. Initialization Steps

elvis performs the following initialization steps. Interestingly, much of the customization for elvis is moved out of editor options and into initialization files.

  1. Initialize all hardcoded options.

  2. Select an interface from those compiled into elvis. elvis will choose the "best" of the ones that are compiled in and that can work. For example, the X11 interface is considered to be better than the termcap interface, but it may not be usable if X Windows is not currently running.

    The selected interface can process the command line for initialization options that are specific to it.

  3. Create the session file if it doesn't exist; otherwise, read it (in preparation for recovery).

  4. Initialize the elvispath option from the ELVISPATH environment variable. Otherwise, give it a default value. "~/.elvislib:/usr/local/lib/ elvis" is a typical value, but the actual value will depend upon how elvis was configured and built.

  5. Search elvispath for an ex script named elvis.ini and run it. The default elvis.ini file performs the following actions:

  6. Load the pre- and post-read and pre- and post-write command files, if they exist. Also load the elvis.msg file. All of these files are described later in this chapter.

  7. Load and display the first file named on the command line.

  8. If the -a option was given, load and display the rest of the files, each in its own window.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.