## 12.5. Multiwindow Editing

vile is somewhat different from the other clones. It started life as a version of Micro-Emacs, and then was modified into an editor with the "finger-feel" of vi.

One of the things that versions of emacs have always done is handle multiple windows and multiple files; as such, vile was the first vi-like program to provide multiple windows and editing buffers.

As in elvis and vim, the `:split` command[59] will create a new window, and then you can use the ex command `:e` `filename` to edit a new file in the new window. After that, things become different, in particular the vi command mode keys to switch among windows are very different.

> [59]That this works is an artifact of the fact that vile allows you to abbreviate commands. The actual command name is `split-current-window`.

>     <preface id="VI6-CH-0">
>     <title>Preface </title>

>     <para>
>     Text editing is one of the most common uses of any computer system, and
>     <command>vi</command> is one of the most useful standard text editors>
>     With <command>vi</command> you can create new files, or edit any exist>
>     file.
>     </para>

>      ch00.sgm                                                         top
>     # Makefile for vi book
>     # Arnold Robbins

>     CHAPTERS = ch00_6.sgm ch00_5.sgm ch00.sgm ch01.sgm ch02.sgm ch03.sgm \
>     	ch04.sgm ch05.sgm ch06.sgm ch07.sgm ch08.sgm
>     APPENDICES = appa.sgm appb.sgm appc.sgm appd.sgm

>     POSTSCRIPT = ch00_6.ps ch00_5.ps ch00.ps ch01.ps ch02.ps ch03.ps \
>     	ch04.ps ch05.ps ch06.ps ch07.ps ch08.ps \

>     === Makefile =[modified]========================================= top ==

The split screen is the result of typing `vile ch00.sgm` followed by `:split` and `:e Makefile`.

Like vim, all windows share the bottom line for execution of ex commands. Each window has its own status line, with the current window indicated by having its status line filled with equal signs. The status line also acquires an `I` in the second column when in insert mode, and `[modified]` is appended after the filename when the file has been changed but not yet written out.

vile is also like emacs in that commands are bound to key sequences. Table 12.1 presents the commands and their key sequences. In some cases, two sets of key sequences do the same operation, for example, the `delete-other-windows` command.

#### Table 12.1. vile Window Management Commands

Command | Key Sequence(s) | Function
--- | --- | ---
`delete-other-windows` | `^O`, `^X 1` | Eliminate all windows except the current one.
`delete-window` | `^K`, `^X 0` | Destroy the current window, unless it is the last one.
`edit-file`, `E`, `e` | `^X e` | Bring given (or under-cursor, for `^X e`) file or existing buffer into window.
`find-file`
`grow-window` | `V` | Increase the size of the current window by count lines.
`move-next-window-down` | `^A ^E` | Move next window down (or buffer up) by count lines.
`move-next-window-up` | `^A ^Y` | Move next window up (or buffer down) by count lines.
`move-window-left` | `^X ^L` | Scroll window to left by count columns, half screen if count unspecified.
`move-window-right` | `^X ^R` | Scroll window to right by count columns, half screen if count unspecified.
`next-window` | `^X o` | Move to the next window.
`position-window` | `z` `where` | Reframe with cursor specified by where, as follows: center (`.`, `M`, `m`), top (RETURN, `H`, `t`), or bottom (`-`, `L`, `b`).
`previous-window` | `^X O` | Move to the previous window.
`resize-window` |  | Change the current window to count lines. count is supplied as a prefix argument.
`restore-window` |  | Return to window saved with `save-window`.
`save-window` |  | Mark a window for later return with `restore-window`.
`scroll-next-window-down` | `^A ^D` | Move next window down by count half screens. count is supplied as a prefix argument.
`scroll-next-window-up` | `^A ^U` | Move next window up by count half screens. count is supplied as a prefix argument.
`shrink-window` | `v` | Decrease the size of the current window by count lines. count is supplied as a prefix argument.
`split-current-window` | `^X 2` | Split the window in half; a count of 1 or 2 chooses which becomes current. count is supplied as a prefix argument.
`view-file` |  | Bring given file or existing buffer into window, mark it "view-only."
`historical-buffer` | `_` | Display a list of the first nine buffers. A digit moves to the given buffer, `__` moves to the most recently edited file.
`toggle-buffer-list` | `*` | Pop up/down a window showing all the vile buffers.

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