Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!bellcore!spectral!sjs From: sjs@spectral.ctt.bellcore.com (Stan Switzer) Newsgroups: comp.editors Subject: VI macros Keywords: editors, vi Message-ID: <15697@bellcore.bellcore.com> Date: 27 Apr 89 14:25:06 GMT References: <175@hcr.UUCP> <587@alice.marlow.uucp> <4048@ttidca.TTI.COM> <960@myrias.UUCP> <24@hcr.UUCP> <4129@ttidca.TTI.COM> <194@xochitl.UUCP> <156@inf.ethz.ch> <3892@mipos3.intel.com> <23162@agate.BERKELEY.EDU> <175@inf.ethz.ch> <238@crdgw1.crd.ge.com> Sender: news@bellcore.bellcore.com Reply-To: sjs@ctt.bellcore.com (Stan Switzer) Organization: Bellcore Lines: 42 In article <238@crdgw1.crd.ge.com> barnett@crdgw1.crd.ge.com (Bruce G. Barnett) writes: > In article <175@inf.ethz.ch>, wyle@inf (Mitchell Wyle) writes: > >" Map insert mode keys > >map! #in #include > >map! #de #define > >map! #un #undef > >map! #el #else > >map! #en #endif > > I use to do this, but stopped because if I cut some text > out of one window system, and pasted it into another window > system, the "#include" would become "#includeclude". Back when I used to use VI I had some mappings like this too. Here are a few of the good ones: map! '' ' map! '// /* map! '/* /* */2hi map! 'in # include "X.h"3hs map! 'is # include 3hs map! 'de # define map! 'if if ( ) { map! 'ei else if ( ) { map! 'el else { map! 'ie if ( ) { map! 'wh while ( ) { map! 'fo for ( ) { map! 'br break; map! 're return;i map! 'sw switch ( ) { map! 'ca case : map! 'fu /* They are set up to work with auto-indent ON. Using a "'" character for a prefix for two-character abbreviations pretty much makes sure you'll not have any conflicts with valid C syntax. I'm not sure, but I think I stole this idea off of Eric Krohn. Stan Switzer sjs@ctt.bellcore.com