-25-Appendix:characterfunctions Thisappendixgivestheusestheeditormakesofeachcharacter.ThecharactersarepresentedintheirorderintheASCIIcharacterset:Controlcharacterscomefirst,thenmostspecial characters,thenthedigits,upperandthenlowercasecharacters. Foreachcharacterwetellameaningithasasacommandandanymeaningithasduringan insert.Ifithasonlymeaningasacommand,thenonlythisisdiscussed.Sectionnumbersin parenthesesindicatewherethecharacterisdiscussed;a‘f’afterthesectionnumbermeansthat thecharacterismentionedinafootnote. ˆ @Notacommandcharacter.Iftypedasthefirstcharacterofaninsertionitis replacedwiththelasttextinserted,andtheinsertterminates.Only128charactersaresavedfromthelastinsert;ifmorecharacterswereinsertedthemechanismisnotavailable.Aˆ @cannotbepartofthefileduetotheeditorimplementation(7.5f). ˆ AUnused. ˆ BBackwardwindow.Acountspecifiesrepetition.Twolinesofcontinuityarekept ifpossible(2.1,6.1,7.2). ˆ CUnused. ˆ DAsacommand,scrollsdownahalf-windowoftext.Acountgivesthenumberof (logical)linestoscroll,andisrememberedforfutureˆ Dandˆ Ucommands (2.1,7.2).Duringaninsert,backtabsoverautoindentwhitespaceatthebeginningofaline(6.6,7.5);thiswhitespacecannotbebackspacedover. ˆ EExposesonemorelinebelowthecurrentscreeninthefile,leavingthecursor whereitisifpossible.(Version3only.) ˆ FForwardwindow.Acountspecifiesrepetition.Twolinesofcontinuityarekept ifpossible(2.1,6.1,7.2). ˆ GEquivalentto:fCR,printingthecurrentfile,whetherithasbeenmodified,the currentlinenumberandthenumberoflinesinthefile,andthepercentageofthe waythroughthefilethatyouare. ˆ H(BS)Sameasleftarrow.(Seeh).Duringaninsert,eliminatesthelastinputcharacter,backingoveritbutnoterasingit;itremainssoyoucanseewhatyou typedifyouwishtotypesomethingonlyslightlydifferent(3.1,7.5). ˆ I(TAB)Notacommandcharacter.Wheninserteditprintsassomenumberofspaces. Whenthecursorisatatabcharacteritrestsatthelastofthespaceswhichrepresentthetab.Thespacingoftabstopsiscontrolledbythetabstopoption(4.1, 6.6). ˆ J(LF)Sameasdownarrow(seej). ˆ KUnused. ˆ LTheASCIIformfeedcharacter,thiscausesthescreentobeclearedandredrawn. Thisisusefulafteratransmissionerror,ifcharacterstypedbyaprogramother thantheeditorscramblethescreen,orafteroutputisstoppedbyaninterrupt (5.4,7.2f). ˆ M(CR)Acarriagereturnadvancestothenextline,atthefirstnon-whitepositioninthe line.Givenacount,itadvancesthatmanylines(2.3).Duringaninsert,aCR causestheinserttocontinueontoanotherline(3.1). ˆ NSameasdownarrow(seej). ˆ OUnused. ˆ PSameasuparrow(seek). ˆ QNotacommandcharacter.Ininputmode,ˆ Qquotesthenextcharacter,the sameasˆ V,exceptthatsometeletypedriverswilleattheˆ Qsothattheeditor -26-neverseesit. ˆ RRedrawsthecurrentscreen,eliminatinglogicallinesnotcorrespondingtophysicallines(lineswithonlyasingle@characteronthem).Onhardcopyterminals inopenmode,retypesthecurrentline(5.4,7.2,7.8). ˆ SUnused.Someteletypedriversuseˆ Stosuspendoutputuntilpressed.ˆ Qis ˆ TNotacommandcharacter.Duringaninsert,withautoindentsetandatthe beginningoftheline,insertsshiftwidthwhitespace. ˆ UScrollsthescreenup,invertingˆ Dwhichscrollsdown.Countsworkastheydo forˆ D,andthepreviousscrollamountiscommontoboth.Onadumbterminal,ˆ Uwilloftennecessitateclearingandredrawingthescreenfurtherbackin thefile(2.1,7.2). ˆ VNotacommandcharacter.Ininputmode,quotesthenextcharactersothatitis possibletoinsertnon-printingandspecialcharactersintothefile(4.2,7.5). ˆ WNotacommandcharacter.Duringaninsert,backsupasbwouldincommand mode;thedeletedcharactersremainonthedisplay(seeˆ H)(7.5). ˆ XUnused. ˆ YExposesonemorelineabovethecurrentscreen,leavingthecursorwhereitisif possible.(Nomnemonicvalueforthiskey;however,itisnexttoˆ Uwhich scrollsupabunch.)(Version3only.) ˆ ZIfsupportedbytheUnixsystem,stopstheeditor,exitingtothetoplevelshell. Sameas:stopCR.Otherwise,unused. ˆ [(ESC)Cancelsapartiallyformedcommand,suchasazwhennofollowingcharacter hasyetbeengiven;terminatesinputsonthelastline(readbycommandssuchas :/and?);endsinsertionsofnewtextintothebuffer.IfanESCisgivenwhen quiescentincommandstate,theeditorringsthebellorflashesthescreen.You canthushitESCifyoudon’tknowwhatishappeningtilltheeditorringsthe bell.Ifyoudon’tknowifyouareininsertmodeyoucantypeESCa,andthen materialtobeinput;thematerialwillbeinsertedcorrectlywhetherornotyou wereininsertmodewhenyoustarted(1.5,3.1,7.5). ˆ \Unused. ˆ ]Searchesforthewordwhichisafterthecursorasatag.Equivalenttotyping :ta,thisword,andthenaCR.Mnemonically,thiscommandis‘‘gorightto’’ (7.3). ˆ ↑Equivalentto:e#CR,returningtothepreviouspositioninthelasteditedfile, oreditingafilewhichyouspecifiedifyougota‘Nowritesincelastchangediagnostic’anddonotwanttohavetotypethefilenameagain(7.3).(Youhaveto doa:wbeforeˆ ↑willworkinthiscase.Ifyoudonotwishtowritethefileyou shoulddo:e!#CRinstead.) ˆ Unused.ReservedasthecommandcharacterfortheTektronix4025and4027 terminal. SPACESameasrightarrow(seel). !Anoperator,whichprocesseslinesfromthebufferwithreformattingcommands. Follow!withtheobjecttobeprocessed,andthenthecommandnameterminatedbyCR.Doubling!andprecedingitbyacountcausescountlinestobefiltered;otherwisethecountispassedontotheobjectafterthe!.Thus2!}fmtCR reformatsthenexttwoparagraphsbyrunningthemthroughtheprogramfmt.If youareworkingonLISP,thecommand!%grindCR,*givenatthebeginningofa function,willrunthetextofthefunctionthroughtheLISPgrinder(6.7,7.3).To *BothfmtandgrindareBerkeleyprogramsandmaynotbepresentatallinstallations.

-27-readafileortheoutputofacommandintothebufferuse:r(7.3).Tosimply executeacommanduse:!(7.3). "Precedesanamedbufferspecification.Therearenamedbuffers1−9usedfor savingdeletedtextandnamedbuffersa−zintowhichyoucanplacetext(4.3, 6.3) #Themacrocharacterwhich,whenfollowedbyanumber,willsubstitutefora functionkeyonterminalswithoutfunctionkeys(6.9).Ininputmode,ifthisis yourerasecharacter,itwilldeletethelastcharacteryoutypedininputmode, andmustbeprecededwitha\toinsertit,sinceitnormallybacksoverthelast inputcharacteryougave. $Movestotheendofthecurrentline.Ifyou:selistCR,thentheendofeachline willbeshownbyprintinga$aftertheendofthedisplayedtextintheline. Givenacount,advancestothecount’thfollowingendofline;thus2$advances totheendofthefollowingline. %Movestotheparenthesisorbrace{}whichbalancestheparenthesisorbraceat thecurrentcursorposition. &Asynonymfor:&CR,byanalogywiththeex&command. ´ Whenfollowedbya´ returnstothepreviouscontextatthebeginningofaline. Thepreviouscontextissetwheneverthecurrentlineismovedinanon-relative way.Whenfollowedbyalettera−z,returnstothelinewhichwasmarkedwith thisletterwithamcommand,atthefirstnon-whitecharacterintheline.(2.2, 5.3).Whenusedwithanoperatorsuchasd,theoperationtakesplaceovercompletelines;ifyouuse` ,theoperationtakesplacefromtheexactmarkedplaceto thecurrentcursorpositionwithintheline. (Retreatstothebeginningofasentence,ortothebeginningofaLISPs-expression ifthelispoptionisset.Asentenceendsata.!or?whichisfollowedbyeither theendofalineorbytwospaces.Anynumberofclosing)]"and´ characters mayappearafterthe.!or?,andbeforethespacesorendofline.Sentences alsobeginatparagraphandsectionboundaries(see{and[[below).Acount advancesthatmanysentences(4.2,6.8). )Advancestothebeginningofasentence.Acountrepeatstheeffect.See( aboveforthedefinitionofasentence(4.2,6.8). *Unused. +SameasCRwhenusedasacommand. ,ReverseofthelastfFtorTcommand,lookingtheotherwayinthecurrent line.Especiallyusefulafterhittingtoomany;characters.Acountrepeatsthe search. −Retreatstothepreviouslineatthefirstnon-whitecharacter.Thisistheinverse of+andRETURN.Ifthelinemovedtoisnotonthescreen,thescreenis scrolled,orclearedandredrawnifthisisnotpossible.Ifalargeamountof scrollingwouldberequiredthescreenisalsoclearedandredrawn,withthecurrentlineatthecenter(2.3). .Repeatsthelastcommandwhichchangedthebuffer.Especiallyusefulwhen deletingwordsorlines;youcandeletesomewords/linesandthenhit.todelete moreandmorewords/lines.Givenacount,itpassesitontothecommand beingrepeated.Thusaftera2dw,3.deletesthreewords(3.3,6.3,7.2,7.4). /Readsastringfromthelastlineonthescreen,andscansforwardforthenext occurrenceofthisstring.Thenormalinputeditingsequencesmaybeusedduringtheinputonthebottomline;anreturnstocommandstatewithoutever searching.ThesearchbeginswhenyouhitCRtoterminatethepattern;the -28-cursormovestothebeginningofthelastlinetoindicatethatthesearchisin progress;thesearchmaythenbeterminatedwithaDELorRUB,orbybackspacingwhenatthebeginningofthebottomline,returningthecursortoitsinitial position.Searchesnormallywrapend-aroundtofindastringanywhereinthe buffer. Whenusedwithanoperatortheenclosedregionisnormallyaffected.Bymentioninganoffsetfromthelinematchedbythepatternyoucanforcewholelines tobeaffected.Todothisgiveapatternwithaclosingaclosing/andthenan offset+nor−n. Toincludethecharacter/inthesearchstring,youmustescapeitwithapreceding\.A↑atthebeginningofthepatternforcesthematchtooccuratthe beginningofalineonly;thisspeedsthesearch.A$attheendofthepattern forcesthematchtooccurattheendofalineonly.Moreextendedpattern matchingisavailable,seesection7.4;unlessyousetnomagicinyour.exrcfile youwillhavetopreceedthecharacters.[*and˜ inthesearchpatternwitha\ togetthemtoworkasyouwouldnaivelyexpect(1.5,2,2,6.1,7.2,7.4). 0Movestothefirstcharacteronthecurrentline.Alsoused,informingnumbers, afteraninitial1−9. 1−9Usedtoformnumericargumentstocommands(2.3,7.2). :Aprefixtoasetofcommandsforfileandoptionmanipulationandescapesto thesystem.InputisgivenonthebottomlineandterminatedwithanCR,and thecommandthenexecuted.YoucanreturntowhereyouwerebyhittingDEL orRUBifyouhit:accidentally(seeprimarily6.2and7.3). ;RepeatsthelastsinglecharacterfindwhichusedfFtorT.Acountiterates thebasicscan(4.1). <Anoperatorwhichshiftslinesleftoneshiftwidth,normally8spaces.Likeall operators,affectslineswhenrepeated,asin<<.Countsarepassedthroughto thebasicobject,thus3<<shiftsthreelines(6.6,7.2). =ReindentslineforLISP,asthoughtheyweretypedinwithlispandautoindent set(6.8). >Anoperatorwhichshiftslinesrightoneshiftwidth,normally8spaces.Affects lineswhenrepeatedasin>>.Countsrepeatthebasicobject(6.6,7.2). ?Scansbackwards,theoppositeof/.Seethe/descriptionabovefordetailson scanning(2.2,6.1,7.4). @Amacrocharacter(6.9).Ifthisisyourkillcharacter,youmustescapeitwitha \totypeitinduringinputmode,asitnormallybacksovertheinputyouhave givenonthecurrentline(3.1,3.4,7.5). AAppendsattheendofline,asynonymfor$a(7.2). BBacksupaword,wherewordsarecomposedofnon-blanksequences,placingthe cursoratthebeginningoftheword.Acountrepeatstheeffect(2.4). CChangestherestofthetextonthecurrentline;asynonymforc$. DDeletestherestofthetextonthecurrentline;asynonymford$. EMovesforwardtotheendofaword,definedasblanksandnon-blanks,likeB andW.Acountrepeatstheeffect. FFindsasinglefollowingcharacter,backwardsinthecurrentline.Acount repeatsthissearchthatmanytimes(4.1). GGoestothelinenumbergivenasprecedingargument,ortheendofthefileifno precedingcountisgiven.Thescreenisredrawnwiththenewcurrentlineinthe centerifnecessary(7.2).

-29-HHomearrow.Homesthecursortothetoplineonthescreen.Ifacountis given,thenthecursorismovedtothecount’thlineonthescreen.Inanycase thecursorismovedtothefirstnon-whitecharacterontheline.Ifusedasthe targetofanoperator,fulllinesareaffected(2.3,3.2). IInsertsatthebeginningofaline;asynonymfor↑i. JJoinstogetherlines,supplyingappropriatewhitespace:onespacebetween words,twospacesaftera.,andnospacesatallifthefirstcharacterofthejoined onlineis).Acountcausesthatmanylinestobejoinedratherthanthedefault two(6.5,7.1f). KUnused. LMovesthecursortothefirstnon-whitecharacterofthelastlineonthescreen. Withacount,tothefirstnon-whiteofthecount’thlinefromthebottom.Oper-atorsaffectwholelineswhenusedwithL(2.3). MMovesthecursortothemiddlelineonthescreen,atthefirstnon-whiteposition ontheline(2.3). NScansforthenextmatchofthelastpatterngivento/or?,butinthereverse direction;thisisthereverseofn. OOpensanewlineabovethecurrentlineandinputstextthereuptoanESC.A countcanbeusedondumbterminalstospecifyanumberoflinestobeopened; thisisgenerallyobsolete,astheslowopenoptionworksbetter(3.1). PPutsthelastdeletedtextbackbefore/abovethecursor.Thetextgoesbackas wholelinesabovethecursorifitwasdeletedaswholelines.Otherwisethetext isinsertedbetweenthecharactersbeforeandatthecursor.Maybeprecededby anamedbufferspecification"xtoretrievethecontentsofthebuffer;buffers1−9 containdeletedmaterial,buffersa−zareavailableforgeneraluse(6.3). QQuitsfromvitoexcommandmode.Inthismode,wholelinesformcommands, endingwithaRETURN.Youcangiveallthe:commands;theeditorsuppliesthe :asaprompt(7.7). RReplacescharactersonthescreenwithcharactersyoutype(overlayfashion). TerminateswithanESC. SChangeswholelines,asynonymforcc.Acountsubstitutesforthatmanylines. Thelinesaresavedinthenumericbuffers,anderasedonthescreenbeforethe substitutionbegins. TTakesasinglefollowingcharacter,locatesthecharacterbeforethecursorinthe currentline,andplacesthecursorjustafterthatcharacter.Acountrepeatsthe effect.Mostusefulwithoperatorssuchasd(4.1). URestoresthecurrentlinetoitsstatebeforeyoustartedchangingit(3.5). VUnused. WMovesforwardtothebeginningofawordinthecurrentline,wherewordsare definedassequencesofblank/non-blankcharacters.Acountrepeatstheeffect (2.4). XDeletesthecharacterbeforethecursor.Acountrepeatstheeffect,butonly charactersonthecurrentlinearedeleted. YYanksacopyofthecurrentlineintotheunnamedbuffer,tobeputbackbya laterporP;averyusefulsynonymforyy.Acountyanksthatmanylines. Maybeprecededbyabuffernametoputlinesinthatbuffer(7.4). ZZExitstheeditor.(Sameas:xCR.)Ifanychangeshavebeenmade,thebufferis writtenouttothecurrentfile.Thentheeditorquits.

-30- [[Backsuptotheprevioussectionboundary.Asectionbeginsateachmacroin thesectionsoption,normallya‘.NH’or‘.SH’andalsoatlineswhichwhichstart withaformfeedˆ L.Linesbeginningwith{alsostop[[;thismakesitusefulfor lookingbackwards,afunctionatatime,inCprograms.Iftheoptionlispisset, stopsateach(atthebeginningofaline,andisthususefulformovingbackwardsatthetoplevelLISPobjects.(4.2,6.1,6.6,7.2). \Unused. ]]Forwardtoasectionboundary,see[[foradefinition(4.2,6.1,6.6,7.2). ↑Movestothefirstnon-whitepositiononthecurrentline(4.4). Unused. ` Whenfollowedbya` returnstothepreviouscontext.Thepreviouscontextis setwheneverthecurrentlineismovedinanon-relativeway.Whenfollowedby alettera−z,returnstothepositionwhichwasmarkedwiththisletterwitham command.Whenusedwithanoperatorsuchasd,theoperationtakesplace fromtheexactmarkedplacetothecurrentpositionwithintheline;ifyouuse´ , theoperationtakesplaceovercompletelines(2.2,5.3). aAppendsarbitrarytextafterthecurrentcursorposition;theinsertcancontinue ontomultiplelinesbyusingRETURNwithintheinsert.Acountcausesthe insertedtexttobereplicated,butonlyiftheinsertedtextisallononeline.The insertionterminateswithanESC(3.1,7.2). bBacksuptothebeginningofawordinthecurrentline.Awordisasequenceof alphanumerics,orasequenceofspecialcharacters.Acountrepeatstheeffect (2.4). cAnoperatorwhichchangesthefollowingobject,replacingitwiththefollowing inputtextuptoanESC.Ifmorethanpartofasinglelineisaffected,thetext whichischangedawayissavedinthenumericnamedbuffers.Ifonlypartofthe currentlineisaffected,thenthelastcharactertobechangedawayismarked witha$.Acountcausesthatmanyobjectstobeaffected,thusboth3c)and c3)changethefollowingthreesentences(7.4). dAnoperatorwhichdeletesthefollowingobject.Ifmorethanpartofalineis affected,thetextissavedinthenumericbuffers.Acountcausesthatmany objectstobeaffected;thus3dwisthesameasd3w(3.3,3.4,4.1,7.4). eAdvancestotheendofthenextword,definedasforbandw.Acountrepeats theeffect(2.4,3.1). fFindsthefirstinstanceofthenextcharacterfollowingthecursoronthecurrent line.Acountrepeatsthefind(4.1). gUnused. Arrowkeysh,j,k,l,andH. hLeftarrow.Movesthecursoronecharactertotheleft.Liketheotherarrow keys,eitherh,theleftarrowkey,oroneofthesynonyms(ˆ H)hasthesame effect.Onv2editors,arrowkeysoncertainkindsofterminals(thosewhichsend escapesequences,suchasvt52,c100,orhp)cannotbeused.Acountrepeatsthe effect(3.1,7.5). iInsertstextbeforethecursor,otherwiselikea(7.2). jDownarrow.Movesthecursoronelinedowninthesamecolumn.Ifthepositiondoesnotexist,vicomesascloseaspossibletothesamecolumn.Synonyms includeˆ J(linefeed)andˆ N. kUparrow.Movesthecursoronelineup.ˆ Pisasynonym.

-31-lRightarrow.Movesthecursoronecharactertotheright.SPACEisasyn-onym. mMarksthecurrentpositionofthecursorinthemarkregisterwhichisspecified bythenextcharactera−z.Returntothispositionorusewithanoperator using` or´ (5.3). nRepeatsthelast/or?scanningcommands(2.2). oOpensnewlinesbelowthecurrentline;otherwiselikeO(3.1). pPutstextafter/belowthecursor;otherwiselikeP(6.3). qUnused. rReplacesthesinglecharacteratthecursorwithasinglecharacteryoutype.The newcharactermaybeaRETURN;thisistheeasiestwaytosplitlines.Acount replaceseachofthefollowingcountcharacterswiththesinglecharactergiven; seeRabovewhichisthemoreusuallyusefuliterationofr(3.2). sChangesthesinglecharacterunderthecursortothetextwhichfollowsuptoan ESC;givenacount,thatmanycharactersfromthecurrentlinearechanged.The lastcharactertobechangedismarkedwith$asinc(3.2). tAdvancesthecursoruptothecharacterbeforethenextcharactertyped.Most usefulwithoperatorssuchasdandctodeletethecharactersuptoafollowing character.Youcanuse.todeletemoreifthisdoesn’tdeleteenoughthefirst time(4.1). uUndoesthelastchangemadetothecurrentbuffer.Ifrepeated,willalternate betweenthesetwostates,thusisitsowninverse.Whenusedafteraninsert whichinsertedtextonmorethanoneline,thelinesaresavedinthenumeric namedbuffers(3.5). vUnused. wAdvancestothebeginningofthenextword,asdefinedbyb(2.4). xDeletesthesinglecharacterunderthecursor.Withacountdeletesdeletesthat manycharactersforwardfromthecursorposition,butonlyonthecurrentline (6.5). yAnoperator,yanksthefollowingobjectintotheunnamedtemporarybuffer.If precededbyanamedbufferspecification,"x,thetextisplacedinthatbuffer also.TextcanberecoveredbyalaterporP(7.4). zRedrawsthescreenwiththecurrentlineplacedasspecifiedbythefollowing character:RETURNspecifiesthetopofthescreen,.thecenterofthescreen,and −atthebottomofthescreen.Acountmaybegivenafterthezandbeforethe followingcharactertospecifythenewscreensizefortheredraw.Acountbefore thezgivesthenumberofthelinetoplaceinthecenterofthescreeninsteadof thedefaultcurrentline.(5.4) {Retreatstothebeginningofthebeginningoftheprecedingparagraph.Aparagraphbeginsateachmacrointheparagraphsoption,normally‘.IP’,‘.LP’,‘.PP’, ‘.QP’and‘.bp’.Aparagraphalsobeginsafteracompletelyemptyline,andat eachsectionboundary(see[[above)(4.2,6.8,7.6). |Placesthecursoronthecharacterinthecolumnspecifiedbythecount(7.1,7.2). }Advancestothebeginningofthenextparagraph.See{forthedefinitionof paragraph(4.2,6.8,7.6). ˜ Unused. ˆ ?(DEL)Interruptstheeditor,returningittocommandacceptingstate(1.5,7.5)

-32- .