from small one page howto to huge articles all in one place
Last additions: May, 25th 2007: April, 26th 2007: Apr, 10th. 2007: |
. You are here: Tutorials per portage category->app-editors->VI
8. Macros
Buffers can also act as macros if they contain valid vi or ex commands.
To execute such a macro, type:
@a - where "a" is the name of the buffer
Example: From a file containing definitions of complex macros, yank
one paragraph (say, 20 lines) to a named buffer "a". Then
return to a file you were originally editing and type @a.
The commands contained in the buffer will be executed on the file
being edited.
It is possible to make files act as vi macros by using command:
:so filename
The most powerful macros, however, are created using programs combined
into shell scripts (or DOS batch files), and acting as filters on the text
sent to them from within vi. Such shell scripts or programs must take standard
input and send results to standard output (which most UNIX tools do).
Even though seemingly strange at first, with a little practice using
vi becomes second nature.
/* The article above and any accompanying files are freely
* distributable, but please leave this notice and the text intact.
* Home for this document: http://www.infobound.com/vi.html
* Copyright (C) 1994, 1999 Tony Thomas
* Contact author through email:tony@infobound.com
* Last revision Feb 23, 1999
* UNIX is a trademark of X/Open
*/
rate this article: current rating: no votes yet Your rating:
back
|