Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!novavax!hcx1!brad From: brad@SSD.CSD.HARRIS.COM (Brad Appleton) Newsgroups: comp.misc Subject: Re: UNIX C-compiler Message-ID: <3659@hcx1.SSD.CSD.HARRIS.COM> Date: 8 Apr 90 16:29:28 GMT References: <1558@wacsvax.OZ> <5154@rtech.rtech.com> <2JO2148xds13@ficc.uu.net> Sender: news@hcx1.SSD.CSD.HARRIS.COM Organization: Harris Computer Systems, Fort Lauderdale, FL Lines: 38 In article <2JO2148xds13@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: >> Yes, a shell >> command from within vi will do the compilation, but either you'll lose your >> errors on return to vi (if you don't redirect stdout), or you won't see >> them in the first place (if you do). > >:map ^C Go^V^[!!cc -c $CFLAGS % > >Now when you hit '^C' your program is compiled and the errors are included at >the end of the file. > I like this a lot Peter! Just to be safe though, anyone who tries this ... make sure you write the file before you use the mapping (or put the "write" command into the mapping). Even the best of us forget this every now & then! For those who arent satisfied with the above ... I bet it wouldnt be obscenely hard to make a shell/awk/sed/perl script to take the output of cc and insert the error messages into the file, after the line in which they occur (anyone care to try this one out?). Then your map command could: 1) write the file 2) compile the program and send/pipe the error output to the script 3) do a re-sync command from vi so that you are now editing the file with the inserted messages. If you want to get fancy, you can put some funky text around the error messages "%%% ###" and add step 4) to search for "^%%%.*###$". You can delete the messages with "g/^%%%.*###$/d" Anyone who has (or composes) such a script please post (or at least e-mail it to me!) -=-=-=-=-=-=-=-=-=-=-= "And miles to go before I sleep." =-=-=-=-=-=-=-=-=-=-=- Brad Appleton Harris Computer Systems brad@ssd.csd.harris.com (305) 973-5007 Fort Lauderdale, FL USA {uunet,novavax}!hcx1!brad -=-=-=-=-=-=-=-=-=-= Disclaimer: I said it, not my company! -=-=-=-=-=-=-=-=-=-