DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Editing files

Storing a command in a buffer

You can store a frequently executed command sequence in a named buffer, and execute it with the command @buffer (buffer is the name of the buffer, such as ``t''). For example, you might want to create a sequence to place you at the end of the file you are editing, and enable you to return to your current location. In this case, carry out the following steps:

  1. Open a new line using o and enter the following sequence of characters:

    maG

    These correspond to the commands to place marker ``a'' at the current position in the file and to go to the end of the file.

  2. Leave text insertion mode by pressing <Esc>.

  3. Copy the line into a buffer using the following:

    ^"tdd

    The ^ moves the cursor to the start of the line, and "tdd deletes the line and stores it in buffer t.

When you issue the command @t, vi reads the contents of buffer ``t'' and treats it as a command typed at the keyboard; vi places marker ``a'' in the text, then goes to the end of the file. (All you need to do to return to your current location is to type the command `a, which is too short to be worth assigning to a key.)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004