Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!ihnp4!houxm!mtuxo!mtune!mtund!adam From: adam@mtund.UUCP (Adam V. Reed) Newsgroups: net.unix-wizards Subject: Editor macro languages Message-ID: <798@mtund.UUCP> Date: Sun, 12-Oct-86 23:58:50 EDT Article-I.D.: mtund.798 Posted: Sun Oct 12 23:58:50 1986 Date-Received: Tue, 14-Oct-86 06:32:13 EDT References: <4508@brl-smoke.ARPA> Organization: AT&T ISL Middletown NJ USA Lines: 29 Kenneth Ng: > Now for a little soap box time. It seems to me that one of the > most powerful features of a text editor is the ability to write > custom programs with a language the editor can understand. The > three editors mentioned above have such features. Therefore > practically any needed function can be added easily. This is the > one feature I find so lacking in VI(1). The macro facility kinda > has this, but I haven't seen the functionality of a real programming > language in this editor. Not unless you consider C, and the Korn shell, and every language available under Unix [tm], something other than "real" programming languages. The "!" command (which can be included in map micros) lets you filter any subset of a file through any pipeline. For example, the vi command to alphabetize lines 23 through 77 is ":23,77!sort^M". There is nothing to stop you from writing a custom C program to use in vi macros, but usually there already are Unix tools around to do the job. Note that the output of a filter can be placed in a buffer and executed (there are spelling correction macros that use this capability). Being able to use the shell, or a programming language of one's choice, instead of having to learn a custom editor macro language, is one of the tremendous advantages of working under Unix. I once implemented a syntax-directed editor as a set of vi macros filtering text through a few shell scripts and one C program, in a quarter of the time it would have taken to write an SDE from scratch. When a novice complains that some part of Unix is not powerful enough, the cure is RTFM. Adam Reed