Path: utzoo!attcan!uunet!mcvax!cernvax!cgch!whbr From: whbr@cgch.UUCP (Hellmuth Broda) Newsgroups: comp.unix.questions Subject: Re: vi - macros using @ symbol Summary: Enter the commands in input mode Keywords: @ vi macros Message-ID: <796@cgch.UUCP> Date: 10 Mar 89 11:17:17 GMT References: <1742@ssc.UUCP> Sender: news@cgch.UUCP Reply-To: whbr@cgchd6.UUCP (Hellmuth Broda) Organization: c/o CIBA-GEIGY Ltd, Sci.Comp.Centre, CH-4002 Basel, Switzerland Lines: 61 In article <1742@ssc.UUCP> Belinda Frazier writes: >Does anyone know how to properly use the macros to >put macro body in buffers using yank or delete operators in vi? > >The information I have is: > >@x invokes macros >@@ repeats last macro > Belinda Try the following approach: At some conspicious place in your file (I usually use the first line in the file so that I won't forget about it) type the commands in input mode which you would normally type in command mode. Then yank that text into a named buffer (e.g. "xY) and issue that macro from command mode (@x). Here is an Example that might get you started: Let's assume that you want to put some key words from some (LaTeX)- Document into the index. Write the following line of text somewhere in your file: yWEa\index{^[pi}^[ yWEa\index{pi} (that line spells: yank Word goto-End-of-Word add `\index{' ESC put Word add `}' ESC Note: you have to enter an ESC as ctrl-V ESC). Then put the cursor at the beginning of that line and type "xy$ (yank into named buffer `x' until end-of-line) Now put the cursor at the word you want to index and press @x Here is how it works: ...an example of getting some key words into the index of your document... ^put cursor here, type @x and your line will change to: ...an example of getting some key words into the index\index{index} of your document... ---voila' >[...] > >Thanks for any help. >Belinda Frazier You are welcome! Hellmuth Broda ___________________________________________________________________________ | Dr.rer.nat. Hellmuth W. Broda | c/o CIBA-GEIGY Scientific Computing Ctr. | | Biologist and Systems Analyst | R-1045.3.16, P.O.Box, Tel:+4161 697-7109 | | UUCP:...!uunet!mcvax!cernvax!cgch!whbr CH-4002 Basel, Switzerland | | Internet:whbr%cgch.uucp@uunet.uu.net; BITNET:whbr%cgch.uucp@cernvax.bitnet| --------------------------------------------------------------------------- ``Chemists do it periodically on the table.''