Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!ncrlnk!ncrcce!mercer From: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) Newsgroups: comp.editors Subject: Re: vi @-macros Message-ID: <1620@ncrcce.StPaul.NCR.COM> Date: 11 Oct 89 18:48:04 GMT References: <754@trlluna.trl.oz> Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) Organization: NCR Comten, Inc. Lines: 58 Keywords: In article <754@trlluna.trl.oz> keck@shiva.trl.oz (Brian Keck) writes: :I have a question about vi @-macros : :I know that if I insert a line : oabcESC :in the main buffer and move it to the buffer called "a" by saying : "add :then I can insert "abc" by saying : @a : :But can I define @-macros in my .exrc file ? :If my .exrc file is : a : oabcESC : . :then vi dumps core. : :Thanks : :Brian Keck ACSnet[Internet]: keck@trlsasb.oz[.au] :Telecom Australia Research Phone: +1 61 3 541 6407 :P.O. Box 249 Clayton, Victoria 3168, Australia :Brian Keck ACSnet[Internet]: keck@trlsasb.oz[.au] :Telecom Australia Research Phone: +1 61 3 541 6407 :P.O. Box 249 Clayton, Victoria 3168, Australia Oddly enough, I've had need to do this very thing. Believe me, it tore me up in knots before I stumbled on the answers. We needed to preload a bunch of macros tied to our pfkeys because we perceived a storage problem with macro space. Turned out, we only had the problem when editing in our HOME directories. our HOME/.exrc was being entered twice - once as the HOME/.exrc and the second time as ./.exrc. We finally solved that problem by moving almost all editable files out of HOME and into more appropriate subdirectories. Meanwhile, we stumbled onto the answer to the above puzzle. Below is a sample .exrc file: e tmpBuf # open a temporary file - this prevents core 0a # append after zero :!echo it worked # load command to temp file . # EOF 1d a # delete line 1 into buffer a w! /dev/null # save file to /dev/null: this unblocks exrc processing The file you are editing is only opened after exrc processing. I hope this helps. I tried it out and it seems to work on my system. I can't access the system the actual code was written for (they're having modem problems). When I can, I'll go look over my old files and make sure there aren't any sneaky refinements I overlooked. -- Dan Mercer Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer)