The screen shots and explanation for this section were supplied
by Steve Kirkendall. We thank him.
's X11 interface
provides a scrollbar and mouse support, and allows you to
select which fonts to use.
There is no way to change fonts after
has created the first window.
The fonts must all be monospace fonts, typically some variation
of a Courier or "fixed" font.
2.0's X11 interface supports
multiple fonts and colors,
a blinking cursor that changes shape to indicate your editing mode
(insert vs. command),
a scrollbar, and mouse actions. The mouse can be used for selecting
text, cutting and pasting between applications, and performing tag
2.1 adds a configurable toolbar,
dialogue windows, a status bar,
It also works better on monochrome X terminals.
2.1 has a significantly improved
X11 interface over 2.0, and because it should be released by the time
this book is published, details in the rest of this section apply
to it. A number of features, several command-line options, and the ability to
via X resources are all missing
from Version 2.0.
The basic elvis
window is shown in
provides a separate text search
pop-up dialogue box, which is shown in
The look and feel are intended to resemble Motif, but elvis
doesn't actually use the Motif libraries.
Command-line options let you choose the four different fonts
uses, normal, italic, bold, and
"control," which is the font for the toolbar text
and button labels.
You may also specify foreground and background colors,
the initial window geometry,
and whether elvis
should start out iconified.
to look for an already running
process, and send it a message requesting it
to start editing the files named on the command line.
Doing it this way allows you to share yanked text and other information
between the files elvis
is currently editing
and the new files.
Besides the toolbar, there is also a status bar that displays
status messages and any available information about toolbar
The mouse behavior tries to strike a balance between
(1) and what makes sense for an editor.
To do this correctly,
distinguishes between clicking and dragging.
Dragging the mouse always selects text.
Dragging with button 1 pressed (usually the left button) selects characters,
dragging with button 2 (the middle button) selects a rectangular area, and
dragging with button 3 (usually the right button) selects whole lines.
These operations correspond to elvis
(These commands are described later in this chapter.)
When you release the button at the end of the drag, the selected text is
immediately copied into an X11 cut buffer, so you can paste it into another
application such as xterm
The text remains selected, so you can apply an operator command to it.
Clicking button 1 cancels any pending selection, and moves the cursor to
the clicked-on character.
Clicking button 3 moves the cursor without canceling the pending selection;
you use this to extend a pending selection.
Clicking button 2 "pastes" text from the X11 cut buffer
If you're entering an
command line, the text will be pasted into the
command line as though you had typed it.
If you're in visual command mode or input mode,
the text will be pasted into
your edit buffer.
When pasting, it doesn't matter where you click in the window;
always inserts the text at
the position of the text cursor.
Double-clicking button 1 simulates a
keystroke, causing elvis
to perform tag lookup on the clicked-on word.
happens to be displaying an HTML document,
then tag lookup pursues hypertext links,
so you can double-click on any underlined text
to view the topic that describes that text.
Double-clicking button 3 simulates a
taking you back to where you did the last tag lookup.
The X11 interface supports a user-configurable toolbar.
By default, the toolbar is enabled unless your
file has a
The default toolbar already has some buttons defined.
You use the
command to reconfigure
There are a number of commands. In particular, you can
reconfigure the toolbar to suit your tastes, deleting one
or all of the existing buttons, adding new ones, and controlling
the spacing between buttons or groups of buttons.
Here is a simple example:
:gui Make " Rebuild the program
These commands add two new buttons. The first line
adds a button named "Make," which
will execute the
command when pressed.
command is described later in this chapter.)
second line adds descriptive text for the "Make" button
that shows up in the status line when the button is pressed.
In this case, the
does not start a comment;
rather it is an operator for the
The second button, named "Quit," is created by
the third line. It exits the
program. The fourth line changes its behavior.
If the condition (
) is true, the button
will behave normally. But if it's false, the button will
ignore any mouse clicks, and it will also be displayed as being
"flat," instead of having the normal 3-D appearance.
Thus, if the current file is modified, you won't be
able to use the "Quit" button to exit.
You can create pop-up dialogues that appear when a toolbar
button is pressed. The dialogue can set the value(s) of
pre-defined variables (options) that can then be tested from
command associated with the button.
There are 26 pre-defined variables, named
, that are set aside for user
"programs" of this sort to use.
This example associates a dialogue with a new button named "Split":
:gui Split"Create a new window, showing a given file
:gui Split;"File to load:" (file) f = filename
:gui Split:split (f)
The first command associates descriptive text with the "Split"
button. The second command creates the pop-up dialogue: its prompt
is File to load:
and it will set the
indicates that any string may
be entered, but that the [TAB]
key may be used for
filename completion. The
f = filename
copies the value of
Finally, the third command actually executes the
command on the value of
, which will be the
new filename supplied by the user.
The facility is quite flexible; see the online help for
the full details.
A large number of options control the X11 interface.
You typically set these in your .exrc
file. There are options and abbreviations for setting the
various fonts, enabling and configuring the toolbar, status bar,
scrollbars, and the cursor.
Other options control the cursor's behavior when
you switch windows with
and whether the
cursor goes back to the original xterm
The online documentation describes all of the X11-related
Here, we describe some of the more interesting ones:
Normally, when the
command switches focus
to an iconified window, that window is de-iconified.
is true, elvis
iconify the old window, so that the number of open elvis
windows remains constant.
The value is a number between 1 and 10 that indicates for how many
tenths of a second the cursor should be visible and then invisible.
A value of 0 disables blinking.
control the position of the first
window that elvis
If not set, the
option or the
window manager controls placement.
set to a non-zero value, any new windows are created that
many pixels down and to the right of the current window.
Setting it to zero lets the window manager to do the placement.
When set, elvis
provides a white outline around characters when using a monochrome
This makes text easier to read.
The value can range from 0 for no outline to 3 for the heaviest;
the default is 2.
This option has no effect on color displays.
Stores a command which runs an interactive shell,
commands, and the
The default value is
, which starts
an interactive terminal emulator in another window.
the scrollbar on the indicated side of the window, while
disables the scrollbar.
The default is
2.1 adds the ability to be configured via
The resource values can be overridden by command-line flags, or by
commands in the initialization scripts.
's resources are listed
in Table 10.4
Table 10.4: elvis X Resources
|(Name is lowercase of class)
The "Timeout" type gives a time value, in tenths of a second.
The "Edge" type gives a scrollbar position,
For example, if your X resource database contains the line
, the default text
font would be
This value would be used if the
option was unset.