12.10. Interesting Features

vile has a number of interesting features that are the topic of this section.

The vile editing model

vile's editing model is somewhat different from vi's. Based on concepts from emacs, it provides key rebinding and a more dynamic command line.

Major modes

vile supports editing "modes." These are groups of option settings that make it convenient for editing different kinds of files.

The procedure language

vile's procedure language allows you to define functions and macros that make the editor more programmable and flexible.

Miscellaneous small features

A number of smaller features make day-to-day editing easier.

12.10.1. The vile Editing Model

In vi and the other clones, editing functionality is "hardwired" into the editor. The association between command characters and what they do is built into the code. For example, the x key deletes characters, and the i key enters insert mode. Without resorting to severe trickery, you cannot switch the functionality of the two keys (if it can even be done at all).

vile's editing model, derived from emacs through MicroEMACS, is different. The editor has defined, named functions, each of which performs a single editing task, such as delete-next-character or delete-previous-character. Many of the functions are then bound to keystrokes, such as binding delete-next-character to x.

Changing bindings is very easy to do. You use the :bind-key command. As arguments, you give it the name of the function, and then the ...

Get Learning the vi Editor, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.