10.10. Interesting Featureselvis has a number of interesting features:
10.10.1. Display Modeselvis has several display modes. Depending on the kind of file, elvis produces a formatted version of the file, producing a WYSIWYG effect. The display modes are outlined in Table 10.11. Table 10.11. elvis Display Modes
The :normal command will switch the display from one of the formatted views to normal mode. Use :display mode to switch back. As a shortcut, the ^W d command will toggle the display modes for the window. Of the available modes, html and man are the most WYSIWYG in nature. The online documentation clearly defines the subset of both markup languages that elvis understands. elvis uses the html mode for displaying its online help, which is written in HTML and has many cross-referencing links within it. The example below shows elvis editing one of the HTML help files. The screen is split. Both windows show the same buffer; the bottom window is using the html display mode, while the top is using the normal display mode: <html><head> <title>Elvis 2.0 Sessions</title> </head><body> <h1>10. SESSIONS, INITIALIZATION, AND RECOVERY</h1> This section of the manual describes the life-cycle of an edit session. We begin with the definition of an <a href="#SESSION">edit session</a> and what that means to elvis. This is followed by sections discussing <a href="#INIT">initialization</a> and <a href="#RECOVER">recovery after a crash.</a> _____________________________________________________________________ 10.0 SESSIONS, INITIALIZATION, AND RECOVERY This section of the manual describes the life-cycle of an edit session. We begin with the definition of an edit session and what that means to elvis. This is followed by sections discussing initialization and recovery after a crash. 10.1 Sessions The man mode is also interesting, since normally you have to format and print a man page to be sure you've done a decent job of laying it out. The following quote from the online help seems appropriate. Troff source was never designed to be interactively edited, and although I did the best I could, attempting to edit in man mode is still a disorienting experience. I suggest you get in the habit of using normal mode when making changes, and man mode to preview the effect of those changes. The ^W d command makes switching between modes a pretty easy thing to do. As an interesting adjunct, both the html and man modes also work with the :color command described in Section 10.9.2. This is particularly nice with man mode. For example, by default on a Linux console, only bold text (.B) is distinguishable from normal text. But with syntax coloring on, both bold and italic (.I) text become distinct. The mode commands are summarized in Table 10.12. Table 10.12. elvis Display Mode Commands
Associated with each window is the bufdisplay option, which should be set to one of the supported display modes. The standard elvis.arf file (see the next subsection) will look at the extension of the buffer's filename and attempt to set the display to a more interesting mode than normal. Finally, elvis can also apply its WYSIWYG formatting to printing the contents of a buffer. The :lpr command formats a line range (or the whole buffer, by default) for printing. You can print to a file or down a pipe to a command. By default, elvis prints to a pipe that executes the system print spooling command. The :lpr command is controlled by several options, described in Table 10.13. Table 10.13. elvis Options for Print Management
Most of the options are self-explanatory. elvis supports several printer types, as described in Table 10.14. Table 10.14. Values for the lptype Option
If you have a PostScript printer, by all means use an lptype of ps or ps2. Use the latter to save paper, which is particularly handy when printing drafts. 10.10.2. Pre- and Post-Operation Control Fileselvis gives you the ability to control its actions at four points when reading and writing files: before and after reading a file, and before and after writing a file. It does this by executing the contents of four ex scripts at those respective points. These scripts are searched for using the directories listed in the elvispath option.
The use of command files to control these actions is quite powerful. It allows you to easily tailor elvis' behavior to suit your needs; in other editors these kinds of features are much more hardwired into the code. Copyright © 2003 O'Reilly & Associates. All rights reserved. |
||||||
|