Exchanges−Version2.0to3.1 Thisupdatedescribesthenewfeaturesandchangeswhichhavebeenmadeinconverting fromversion2.0to3.1ofex.Eachchangeismarkedwiththefirstversionwhereitappeared. Versions2.1through2.7wereimplementedbyBillJoy;MarkHortonproducedversions2.8,2.9 and3.1andismaintainingthecurrentversion. UpdatetoExReferenceManual Commandlineoptions 2.1Invokingexvia %ex−l nowsetsthelispandshowmatchoptions.Thisissuitableforinvocationsfromwithin lisp(1).Ifyoudon’tlikeshowmatchyoucanstilluse‘‘ex−l’’togetlispset,justputthe command‘‘setnoshowmatch’’inyour.exrcfile. 3.1Invokingexwithanargument−wnsetsthevalueofthewindowoptionbeforestarting;this isparticularlysuitablewheninvokingvi,thus %vi−w5ex2.0-3.1 editsthefilewitha5lineinitialwindow. 2.9Thetextaftera+onthecommandlineisnolongerlimitedtobeingalinenumber,butcan beanysinglecommand.Thisgeneralityisalsoavailablewithintheeditoroneditandnext commands(butnoblanksareallowedinsuchcommands.)Averyusefulformofthisoption isexemplifiedby %vi+/mainmore.c Commandaddressing 2.9Theaddressform%isshortfor‘‘1,$’’. Commands 2.2Theeditornowignoresa‘‘:’’infrontofcommands,soyoucansay‘‘:wq’’evenincommand mode. 2.8Theglobalcommandnowdoessomethingsensiblewhenyousay g/pat/ printingalllinescontainingpat;beforethisprintedthefirstlineaftereachlinecontaining pat.Thetrailing/maybeomittedhere. 3.1Newcommandsmapandunmaphavebeenaddedwhichareusedwithmacrosinvisual mode.Thesearedescribedbelow. 3.1Thenextcommandnowadmitsanargumentoftheform‘‘+command’’asdescribedabove. 3.1Thesubstitutecommand,givennoarguments,nowrepeatstheprevioussubstitute,justas ‘‘&’’does.Thisiseasiertotype. 2.8Thesubstititutecommand‘‘s/str’’,omittingthedelimiterontheregularexpression,now deletes‘‘str’’;previouslythiswasanerror. 2.9Duringpatternsearchesofatagcommand,theeditorusesnomagicmode;previouslya funny,undocumentedmodeofsearchingwasused. 3.1Theeditorrequiresthatthetagnamesinthetagsfilebesorted. 2.3ThecommandPisasynonymforprint.

-2-2.9Thedefaultstartingaddressforzis.+1.Ifzisfollowedbyanumber,thenthisnumberis rememberedbysettingthescrolloption. 2.9Acommandconsistingofonlytwoaddresses,e.g.‘‘1,10’’nowcausesallthelinestobe printed,ratherthanjustthelastline. Options 2.8Autowrite(whichcanbeabbreviatedaw)isanon/offoption,offbydefault.Ifyousetthis option,thentheeditorwillperformwritecommandsifthecurrentfileismodifiedandyou giveanext,ˆ ˆ (invisual),!ortagcommands,(andnoticeablynotbeforeeditcommands.) Notethatthereisanequivalentwaytodothecommandwithautowritesetwithoutthe writeineachcase:edit,:e#,shellandtag!donotautowrite. 3.1Anewoptionedcompatiblecausesthepresenceorabsenceofgandcsuffixesonsubstitute commandstoberemembered,andtobetoggledbyrepeatingthesuffices.Thesuffixr makesthesubstitutionbeasinthe˜ commandinsteadoflike&. 2.8Thereisanewhardtabsoption,whichisnumericanddefaultsto8.Changingthisto,say,4, tellsexthateitheryousystemexpandstabstoevery4spaces,oryourterminalhashardwaretabssetevery4spaces. 3.1Thereisanewbooleanoptionmapinputwhichisdescribedwiththemacrofacilityforvisual below. 2.9Whetherexpromptsforcommandsnowdependsonlyonthesettingofthepromptvariable sothatyoucansay‘‘setprompt’’insidescript(1)andgetextoprompt. Environmentenquiries 3.1ExwillnowexecuteinitialcommandsfromtheEXINITenvironmentvariableratherthan .exrcifitfindsuchavariable. 2.9ExwillreadtheterminaldescriptionfromtheTERMCAPenvironmentvariableifthe descriptionthereistheonefortheTERMintheenvironment.TERMCAPmaystillbea pathname(startingwitha/;inthatcasethiswillbeusedasthetermcapfileratherthan /etc/termcap,andtheterminaldescriptionwillbesoughtthere.)

-3-ViTutorialUpdate Changeindefaultoptionsettings. 3.1Thedefaultsettingforthemagicoptionisnowmagic.Thusthecharacters .[*˜ arespecialinscanningpatternsinvi.Youshould setnomagic inyour.exrcifyoudon’tusetheseregularly.Thismakesvidefaultlikeex.Inarelated change,beautifyisnolongerthedefaultforvi. Linewraparound 2.4ThewWbBeandEoperationsinvisualnowwraparoundlineboundaries.Thusa sequenceofenoughwcommandswillgettoanywordafterthecurrentpositioninthefile, andb’swillbackuptoanypreviousposition.Thusthesearemorelikethesentenceoperations(and).(Youstillcan’tbackaroundlineboundariesduringinsertshowever.) 2.3The/and?searchesnowfindthenextorpreviousinstanceofthesearchedforstring.Previously,theywouldnotfindstringsonthecurrentline.Thusyoucanmovetotherighton thecurrentlinebytyping‘‘/pref<ESC>’’where‘‘pref’’isaprefixofthewordyouwishto moveto,anddeletetoafollowingstring‘‘str’’bydoing‘‘d/str<ESC>’’,whetheritisonthe sameorasucceedingline.(Previouslythecommand‘‘d/pat/’’deletedlinesthroughthe nextlinecontaining‘‘pat’’.Thiscanbeaccomplishednowbythesomewhatunusualcommand‘‘d/pat/0’’,whichisshortfor‘‘d/pat/+0’’.Thepointisthatwholelinesareaffected ifthesearchpatteronlyspecifiesaline,andusingaddressarithmeticmakesthepattern onlyspecifyaline.) 3.1Arrowkeysonterminalsthatsendmorethan1characternowwork.Homeupkeysaresupportedasarethefourdirections.(NotethattheHP2621willturnonfunctionkeylabels, andeventhenyouhavetoholdshiftdowntousethearrowkeys.Toavoidturningonthe labels,andtogiveupthefunctionkeys,useterminaltype2621nlinsteadof2621.) Macros 3.1Aparameterlessmacrofacilityisincludedfromvisual.Thisfacilityletsyousaythatwhen youtypeaparticularkey,youreallymeansomelongersequenceofkeys.Itisusefulwhen youfindyourselftypingthesamesequenceofcommandsrepeatedly. Briefly,therearetwoflavorsofmacros: a)Putthemacrobodyinabufferregister,sayx.Thentype@xtoinvokeit.@maybe followedbyanother@torepeatthelastmacro.Thisallowsmacrosupto512chars. b)Usethemapcommandfromcommandmode(typicallyinthe.exrcfile)asfollows: maplhsrhs wherelhswillbemappedtorhs.Therearerestrictions:lhsshouldbe1-keystroke(either1 charor1functionkey)sinceitmustbeenteredwithin1second.Thelhscanbenolonger than10chars,therhsnolongerthan100.Togetspace,tab,‘‘|’’,ornewlineintolhsorrhs, escapethemwithctrlV.(ItmaybenecessarytoescapethectrlVwithctrlVifthemap commandisgivenfromvisualmode.)Spacesandtabsinsidetherhsneednotbeescaped. Forexample,tomaketheQkeywriteandexittheeditor,youcando :mapQ:wqˆ VCR whichmeansthatwheneveryoutype‘Q’,itwillbeasthoughyouhadtypedthefourcharacters:wqCR.ThecontrolVisneededbecausewithoutitthereturnwouldendthecolon command.

-4-For1shotmacrositisbesttoputthemacroinabufferregisterandmapakeyto‘@r’, sincethiswillallowthemacrotobeedited. Macroscanbedeletedwith unmaplhs Ifthelhsofamacrois‘‘#0’’through‘‘#9’’,thismapstheparticularfunctionkeyinsteadof the2char#sequence,iftheterminalhasfunctionkeys.Forterminalswithoutfunction keys,thesequence#xmeansfunctionkeyx,foranydigitx.Asaspecialcase,onterminals withoutfunctionkeys,the#xsequenceneednotbetypedwithinonesecond.Thecharacter #canbechangedbyusingamacrointheusualway: mapˆ Vˆ I# tousetab,forexample.(Thiswon’taffectthemapcommand,whichstilluses#,butjust theinvocationfromvisualmode.)Theundocommandwillundoanentiremacrocallasa unit. 3.1Newcommandsinvisual:ˆ Yandˆ E.Thesescrollthescreenupanddown1line,respectively.Theycanbegivencounts,controllingthenumberoflinesthescreenisscrolled.They differfromˆ Uandˆ Dinthatthecursorstaysoverthesamelineinthebufferitwasover beforeratherthanstayinginthesameplaceonthescreen.(ˆ Yonadumbterminalwitha fullscreenwillredrawthescreenmovingthecursorupafewlines.)Ifyou’relookingfor mnemonicvalueinthenames,trythis:YisrightnexttoUandEisrightnexttoD. Miscellaneous 3.1Invisual:‘&’isasynonymfor‘:&<cr>’. 2.2Ininputmodeinopenandvisualˆ V(liketenex)isnowequivalenttoˆ Q(whichisreminiscentofITS)superquotingthenextcharacter. 2.8Thej,k,andlkeysnowmovethecursordown,up,andright,respectively,invisualmode, astheyusedtodo(andalwaysdidonsometerminals).Thisistoavoidthecreepingof thesekeysintothemapdescriptionsofterminalsandtocompensateforthelackofarrow keysonsometerminals. 2.5The$commandnowsetsthecolumnforfuturecursormotionstoeffectiveinfinity.Thusa ‘$’followedbyup/downcursormotionsmovesattherightmarginofeachline. 2.9Thewaywindowsizesandscrollingcommandsarebasedontheoptionswindowandscroll hasbeenrearranged.Allcommandmodescrollingcommands(zandctrlD)arebasedon scroll:ˆ Dmovesscrolllines,zmovesscroll*2lines.Everythinginvisual(ˆ D,ˆ U,ˆ F,ˆ B,z, windowsizesingeneral)arebasedonthewindowoption.Thedefaultsarearrangedsothat everythingseemsasbefore,butonhardcopyterminalsat300baudthedefaultforscrollis 11insteadof6.