home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeLearning the vi EditorSearch this book

12.6. GUI Interfaces

The screen shots and the explanation in this section were supplied by Kevin Buettner, Tom Dickey, and Paul Fox. We thank them.

There are several X11 interfaces for vile, each utilizing a different toolkit based on the Xt library. There is a plain "No Toolkit" version which does not use a toolkit, but has custom scrollbars and a bulletin board widget for geometry management. There are versions which use the Motif, Athena, or OpenLook toolkits. Of these, the "No Toolkit" version is probably best supported since that is the version that some of vile's authors most frequently use. But the Motif and Athena versions have more features, such as menu support.

Fortunately, the basic interface is the same for each of these versions. There is a single top level window which may be split into two or more panes. The panes, in turn, may be used to display multiple views of a buffer or multiple buffers or mixture of both. In vile parlance these panes are called "windows," but to avoid confusion, we will continue to call them "panes" in the following discussion.

12.6.2. Basic Appearance and Functionality

The figures show xvile's Motif interface. It is similar to the Athena interface.

Figure 12.1

Figure 12.1. The vile GUI window

Figure 12.1 shows three panes:

  1. The man page for vile, which shows the use of underlining and boldface.

  2. A buffer misc.c, from tin, which shows syntax highlighting (again, underlining, this time for preprocessor statements, and boldface, for quoted strings).

  3. A three-line pane, which is active (noted by a darker status line), named [Completions], for filename completions. The pane is coordinated with the minibuffer (the colon command line): the first line reads Completions prefixed by /tmp/m:, and the minibuffer reads Find file: m. The rest of the pane contains the actual filenames which match. The first line of [Completions] and the contents change as the user completes the filename (and presses TAB to tell vile to show the reduced set of choices).

Figure 12.2

Figure 12.2. Buffers and completions in vile

Figure 12.2 also shows three panes:

  1. The [Help] pane, which of course shows the most important feature of an editor (how to exit without modifying your files). Figure

  2. The [Buffer List], which indicates that [Help] is the # (previous) buffer. The % (current) buffer is not shown on the list, since only the "visible" buffers are displayed in this copy of [Buffer List]. Supplying an argument to the * command would have shown the invisible buffers as well. Buffers 1 and 2 are charset.c and misc.c. They have been loaded, so their sizes (8931 and 54866) are displayed in the [Buffer List]. Buffers 3, 4, and 5 (color.c, config.c, and curses.c) have not been loaded, so a u is displayed in the first column, and the size is shown as zero.

  3. The [Completions] buffer is active. This time it displays tag completions for the partial match co, and the Completions prefixed message is not shown because the buffer is scrolled down, which is another side effect of pressing TAB: vile cycles through a scrolling action so that all of the choices will be shown even when the window is small. (The v/V commands don't do anything to the [Completions] buffer while the cursor is in the minibuffer; the [Completions] buffer is automatically sized.)

12.6.2.1. Scrollbars

At the right of each pane is a scrollbar which may be used in the customary fashion to move about in the buffer. Note, however, that the customary fashion varies from toolkit to toolkit. In the Athena and "No Toolkit" version, the middle mouse button may be used to drag the "thumb" or visible indicator around. The left and right mouse buttons move down or up (respectively) in the buffer. The amount moved depends on the location of the mouse cursor on the scrollbar. Placing it near the top will scroll by as little as one line. When placed near the bottom, the text will scroll by as much as a full paneful.

The Motif and OpenLook scrollbars are probably more familiar. The left-most mouse button is used for all operations. Clicking on the little arrows will move up or down by one line. The scrollbar indicator may be dragged in order to move about and scrolling up or down by an entire pane may be accomplished by clicking above or below the indicator. The OpenLook scrollbars provide additional mechanisms for quickly moving to the top or bottom of the buffer.

In each version, there is a small handle above or below (i.e., between) scrollbars which may be used to adjust the size of two adjacent panes. In the "No Toolkit" version of xvile, the pane resize handle blends in with the mode line of two adjacent panes. In the other versions, the resize handle is more distinguishable. But in each case, the mouse cursor will change to a heavy vertical double arrow when placed above the resize handle. The windows may be resized by clicking on and dragging the handle.

A pane may be split into two by holding the control key down and clicking the left mouse button on a scrollbar. Then you will have two views of a particular buffer. Other vile commands may be used to replace one of the views with another buffer if desired. A pane may be deleted by holding the control key down and clicking the middle mouse button. Sometimes after creating a lot of panes, you find yourself wanting to use all of the window real estate for just one pane. To do this, control-click the right mouse button; all other panes will be removed, leaving the entire xvile window containing only the pane on which you clicked.

12.6.2.3. Selections

Selections may be made by holding the left mouse button down and dragging with the mouse. Release of the mouse button will cause the selection to be yanked and made available (if desired) for pasting. You can force the selected region to be rectangular by holding the control key down while dragging with the left button depressed. If the dragging motion goes out of the current window, text will be scrolled in the appropriate direction, if possible, to accommodate selections larger than the window. The speed at which the scrolling occurs will increase with the passage of time, making it practical to select large regions of text quickly.

Individual words or lines may be selected by double- or triple-clicking on them.

A selection may be extended by clicking the right mouse button. As with button one, the selection may be adjusted or scrolled by holding the right button down and dragging with it. Selections may be extended in any window open to the same buffer as the one in which the selection was started. That is, if you have two views of a buffer (in two different panes), one containing the start of the buffer, and the other the end, it is possible to select the entire buffer by clicking the left button at the beginning of the pane showing the beginning of the buffer and then clicking the right button in the pane showing the end of the buffer. Also, selections may be extended in a rectangular fashion by holding the control key down in conjunction with the use of the right mouse button.

The middle button is used for pasting the selection. By default, it pastes at the last text cursor position. If the shift key is held down while clicking the middle button, the paste occurs at the position of the mouse cursor.

A selection may be cleared (if owned by xvile) by double-clicking on one of the mode lines.

12.6.2.5. Resources

xvile has many resources which may be used to control appearance and behavior. Font choice is particularly important if you want italic or oblique fonts to be displayed properly. vile's documentation has a complete list of resources as well a sample set of .Xdefault entries.



Library Navigation Links

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