关闭

关闭

封号提示

内容

首页 vi.and.Vim.Editors.Pocket.Reference.2nd.Edition…

vi.and.Vim.Editors.Pocket.Reference.2nd.Edition.pdf

vi.and.Vim.Editors.Pocket.Refer…

上传者: yjice 2011-06-07 评分1 评论0 下载639 收藏0 阅读量1513 暂无简介 简介 举报

简介:本文档为《vi.and.Vim.Editors.Pocket.Reference.2nd.Editionpdf》,可适用于IT书籍领域,主题内容包含viandVimEditorsPocketReferenceSECONDEDITIONviandVimEditorsPocketReferenceA符等。

viandVimEditorsPocketReferenceSECONDEDITIONviandVimEditorsPocketReferenceArnoldRobbinsBeijing•Cambridge•Farnham•Köln•Sebastopol•TokyoviandVimEditorsPocketReference,SecondEditionbyArnoldRobbinsCopyrightArnoldRobbinsAllrightsreservedPrintedinCanadaPublishedbyO’ReillyMedia,Inc,GravensteinHighwayNorth,Sebastopol,CAO’Reillybooksmaybepurchasedforeducational,business,orsalespromotionaluseOnlineeditionsarealsoavailableformosttitles(http:mysafaribooksonlinecom)Formoreinformation,contactourcorporateinstitutionalsalesdepartment:()orcorporateoreillycomEditor:AndyOramCopyeditor:AmyThomsonProductionEditor:AdamZarembaProofreader:SadaPreischIndexer:JohnBickelhauptCoverDesigner:KarenMontgomeryInteriorDesigner:DavidFutatoIllustrator:RobertRomanoPrintingHistory:January:FirstEditionJanuary:SecondEditionNutshellHandbook,theNutshellHandbooklogo,andtheO’ReillylogoareregisteredtrademarksofO’ReillyMedia,IncviandVimEditorsPocketReference,theimageofatarsier,andrelatedtradedressaretrademarksofO’ReillyMedia,IncManyofthedesignationsusedbymanufacturersandsellerstodistinguishtheirproductsareclaimedastrademarksWherethosedesignationsappearinthisbook,andO’ReillyMedia,Inc,wasawareofatrademarkclaim,thedesignationshavebeenprintedincapsorinitialcapsWhileeveryprecautionhasbeentakeninthepreparationofthisbook,thepublisherandauthorassumenoresponsibilityforerrorsoromissions,orfordamagesresultingfromtheuseoftheinformationcontainedhereinISBN:TMContentsviandVimEditorsPocketReferenceIntroductionConventionsAcknowledgmentsCommandLineOptionsviCommandsInputModeShortcutsSubstitutionandRegularExpressionsexCommandsInitializationRecoveryvisetOptionsNothingliketheOriginalEnhancedTagsandTagStacksVimviImprovednviNewvielvisvilevilikeEmacsInternetResourcesforviProgramSourceandContactInformationIndexvviandVimEditorsPocketReferenceIntroductionThispocketreferenceisacompaniontoLearningtheviandVimEditors,byArnoldRobbinsetalItdescribesthevicommandlineoptions,commandmodecommands,excommandsandoptions,regularexpressionsandtheuseofthesubstitute(s)command,andotherpertinentinformationforusingviWhileretainingcoverageoftheviclones,nvi,elvis,andvile,thiseditionoffersexpandedcoverageoftheVimeditor,whichhasbecomethedefactostandardversionofviintheGNULinuxworldTheSolarisversionofviservedasthe“reference”versionoftheoriginalviforthispocketreferenceConventionsThefollowingfontconventionsareusedinthisbook:CourierUsedforfilenames,commandnames,options,andeverythingtobetypedliterallyCourierItalicUsedforreplaceabletextwithincommandsItalicUsedforreplaceabletextwithinregulartext,InternetURLs,foremphasis,andfornewtermswhenfirstdefinedIdentifiesoptionaltextthebracketsarenottypedCTRLGIndicatesakeystrokeAcknowledgmentsThankstoRobertPJDayandElbertHannah,whoreviewedthiseditionTheproductionteamatO’ReillyMediadidagreatjobhelpingmemakethebooklookthewayIwantedAspecialthankstomyeditor,AndyOram,forkeepingtheprojectmovingwithcontinualgentleencouragementCommandLineOptionsCommandActionvifileInvokevionfilevifilefileInvokevionfilessequentiallyviewfileInvokevionfileinreadonlymodeviRfileInvokevionfileinreadonlymodevirfileRecoverfileandrecenteditsafteracrashvittagLookuptagandstarteditingatitsdefinitionviwnSetthewindowsizetonusefuloveraslowconnectionvifileOpenfileatlastlinevinfileOpenfiledirectlyatlinenumbern|viandVimEditorsPocketReferenceCommandActionviccommandfileOpenfile,executecommand,whichisusuallyasearchcommandorlinenumber(POSIX)vipatternfileOpenfiledirectlyatpatternexfileInvokeexonfileexfile<scriptInvokeexonfile,takingcommandsfromscriptsuppressinformativemessagesandpromptsexsfile<scriptInvokeexonfile,takingcommandsfromscriptsuppressinformativemessagesandprompts(POSIX)viCommandsvicommandsareusedin“screen”mode(thedefault),whereyouusethecommandstomovearoundthescreenandtoperformoperationsonthetextMostvicommandsfollowageneralpattern:commandnumbertextobjectortheequivalentform:numbercommandtextobjectMovementCommandsvimovementcommandsdistinguishbetweentwokindsof“words”Thelowercasecommandsdefineawordasacontiguoussequenceofunderscores,letters,anddigitsTheuppercasecommandsdefineawordasacontiguoussequenceofnonwhitespacecharactersviCommands|CommandMeaningCharacterh,j,k,lLeft,down,up,right(,,,)Textw,W,b,BForward,backwardbyworde,EEndofword),(Beginningofnext,previoussentence},{Beginningofnext,previousparagraph,Beginningofnext,previoussectionLinesENTERFirstnonblankcharacterofnextline,$First,lastpositionofcurrentline^Firstnonblankcharacterofcurrentline,Firstnonblankcharacterofnext,previouslinen|ColumnnofcurrentlineH,M,LTop,middle,lastlineofscreennHn(number)oflinesaftertoplinenLn(number)oflinesbeforelastlineScrollingCTRLF,CTRLBScrollforward,backwardonescreenCTRLDCTRLUScrolldown,uponehalfscreenCTRLECTRLYShowonemorelineatbottom,topofwindowzENTERRepositionlinewithcursor:totopofscreenzRepositionlinewithcursor:tomiddleofscreenz–Repositionlinewithcursor:tobottomofscreenCTRLLRedrawscreen(withoutscrolling)|viandVimEditorsPocketReferenceCommandMeaningSearchespatternSearchforwardforpatternpatternSearchbackwardforpatternn,NRepeatlastsearchinsame,oppositedirection,Repeatprevioussearchforward,backwardfxSearchforwardforcharacterxincurrentlineFxSearchbackwardforcharacterxincurrentlinetxSearchforwardtocharacterbeforexincurrentlineTxSearchbackwardtocharacterafterxincurrentlineRepeatpreviouscurrentlinesearch,RepeatpreviouscurrentlinesearchinoppositedirectionLinenumberCTRLGDisplaycurrentlinenumbernGMovetolinenumbernGMovetolastlineinfile:nMovetolineninfileMarkingpositionmxMarkcurrentpositionasx‘xMovecursortomarkx(graveaccent)‘‘Returntopreviousmarkorcontext(twograveaccents)’xMovetobeginningoflinecontainingmarkx(singlequote)’’Returntobeginningoflinecontainingpreviousmark(twosinglequotes)viCommands|EditingCommandsCommandActionInserti,aInserttextbefore,aftercursorI,AInserttextbeforebeginning,afterendoflineo,OOpennewlinefortextbelow,abovecursorChangecwChangewordccChangecurrentlinecmotionChangetextbetweenthecursorandthetargetofmotionCChangetoendoflinerReplacesinglecharacterRTypeover(overwrite)characterssSubstitute:deletecharacterandinsertnewtextSSubstitute:deletecurrentlineandinsertnewtextDelete,movexDeletecharacterundercursorXDeletecharacterbeforecursordwDeletewordddDeletecurrentlinedmotionDeletetextbetweenthecursorandthetargetofmotionDDeletetoendoflinep,PPutdeletedtextafter,beforecursor"npPuttextfromdeletebuffernumbernaftercursor(forlastninedeletions)YankywYank(copy)word|viandVimEditorsPocketReferenceCommandActionyyYankcurrentline"ayyYankcurrentlineintonamedbuffera(a–z)uppercasenamesappendtextymotionYanktextbetweenthecursorandthetargetofmotionp,PPutyankedtextafter,beforecursor"aPPuttextfrombufferabeforecursor(a–z)OthercommandsRepeatlasteditcommandu,UUndolasteditrestorecurrentlineJJointwolinesexeditcommands:dDeletelines:mMovelines:coor:tCopylines:,$dDeletefromcurrentlinetoendoffile:,mMovelinesthroughtotopoffile:,patternco$CopyfromcurrentlinethroughlinecontainingpatterntoendoffileExitCommandsCommandMeaning:wWrite(save)file:w!Write(save)file,overridingprotection:wqWrite(save)andquitfile:xWrite(save)andquitfileZZWrite(save)andquitfile:,wnewfileWritefromlinethroughlineasnewfile:,w>>fileWritefromlinethroughlineandappendtofileviCommands|CommandMeaning:wnewWritecurrentbuffernamedfileasfilenew:qQuitfile:q!Quitfile,overridingprotectionQQuitviandinvokeex:efileEditfilewithoutleavingvi:nEditnextfile:e!Returntoversionofcurrentfileasoftimeoflastwrite(save):e#Editalternatefile:viInvokevieditorfromex:InvokeoneexcommandfromvieditorCurrentfilename(substitutesintoexcommandline)#Alternatefilename(substitutesintoexcommandline)SolarisviCommandModeTagCommandsCommandAction^Lookupthelocationoftheidentifierunderthecursorinthetagsfileandmovetothatlocationiftagstackingisenabled,thecurrentlocationisautomaticallypushedontothetagstack^TReturntothepreviouslocationinthetagstack,ie,popoffoneelementBufferNamesBuffernamesBufferuse–Thelastninedeletions,frommosttoleastrecenta–zNamedbufferstouseasneededuppercaselettersappendtotherespectivebuffers|viandVimEditorsPocketReferenceBufferandMarkingCommandsCommandMeaning"bcommandDocommandwithbufferbmxMarkcurrentpositionwithx‘xMovecursortocharactermarkedbyx(graveaccent)‘‘Returntoexactpositionofpreviousmarkorcontext(twograveaccents)’xMovecursortofirstcharacteroflinemarkedbyx(singlequote)’’Returntobeginningofthelineofpreviousmarkorcontext(twosinglequotes)InputModeShortcutsviprovidestwowaystodecreasetheamountoftypingyouhavetodo:abbreviationsandmapsWordAbbreviation:ababbrphraseDefineabbrasanabbreviationforphrase:abListalldefinedabbreviations:unababbrRemovedefinitionofabbrCommandandInputModeMaps:mapxsequenceDefinecharacter(s)xasasequenceofeditingcommands:unmapxDisablethesequencedefinedforx:mapListthecharactersthatarecurrentlymappedInputModeShortcuts|:map!xsequenceDefinecharacter(s)xasasequenceofeditingcommandsortextthatwillberecognizedininsertmode:unmap!xDisablethesequencedefinedfortheinsertmodemapx:map!ListthecharactersthatarecurrentlymappedforinterpretationininsertmodeForbothcommandandinsertmodemaps,themapnamexcantakeseveralforms:OnecharacterWhenyoutypethecharacter,viexecutestheassociatedsequenceofcommandsMultiplecharactersAllthecharactersmustbetypedwithinonesecondThevalueofnotimeoutchangesthebehavior#nFunctionkeynotation:a#followedbyadigitnrepresentsthesequenceofcharacterssentbythekeyboard’sfunctionkeynumbernToentercharacterssuchasEscape(^)orcarriagereturn(^M),firsttypeCTRLV(^V)ExecutableBuffersNamedbuffersprovideyetanotherwaytocreate“macros”complexcommandsequencesyoucanrepeatwithafewkeystrokesHere’showit’sdone:TypeavicommandsequenceoranexcommandprecededbyacolonreturntocommandmodeDeletethetextintoanamedbufferExecutethebufferwiththecommandfollowedbythebufferletterTheexcommand:bufnameworkssimilarly|viandVimEditorsPocketReferenceSomeversionsofvitreat*identicallytowhenusedfromtheexcommandlineInaddition,ifthebuffercharactersuppliedaftertheor*commandsis*,thecommandistakenfromthedefault(unnamed)bufferAutomaticIndentationEnableautomaticindentationwiththefollowingcommand::setautoindentFourspecialinputsequencesaffectautomaticindentation:^TAddonelevelofindentationtypedininsertmode^DRemoveonelevelofindentationtypedininsertmode^^DShiftthecursorbacktothebeginningoftheline,butonlyforthecurrentline*^DShiftthecursorbacktothebeginningofthelineandresetthecurrentautoindentleveltozero†Twocommandscanbeusedforshiftingsourcecode:<<Shiftalinelefteightspaces>>ShiftalinerighteightspacesThedefaultshiftisthevalueofshiftwidth,usuallyeightspacesSubstitutionandRegularExpressionsRegularexpressions,andtheirusewiththesubstitutecommand,arewhatgivevimostofitssignificanteditingpower*^^Dand^Darenotinelvis†Thenvidocumentationhasthesetwocommandsswitched,buttheprogramactuallybehavesasdescribedhereSubstitutionandRegularExpressions|TheSubstituteCommandThegeneralformofthesubstitutecommandis::addr,addrsoldnewflagsOmittingthesearchpattern(:sreplacement)usesthelastsearchorsubstitutionregularexpressionAnemptyreplacementpart(:spattern)“replaces”thematchedtextwithnothing,effectivelydeletingitfromthelineSubstitutionflagsFlagMeaningcConfirmeachsubstitutiongChangealloccurrencesofoldtonewoneachline(globally)pPrintthelineafterthechangeismadeIt’softenusefultocombinethesubstitutecommandwiththeexglobalcommand,:g::gObjectOrientedsBuzzwordcompliantgviRegularExpressions(period)MatchesanysinglecharacterexceptanewlineRememberthatspacesaretreatedascharacters*Matcheszeroormore(asmanyasthereare)ofthesinglecharacterthatimmediatelyprecedesitThe*canfollowametacharacter,suchas,orarangeinbrackets^Whenusedatthestartofaregularexpression,^requiresthatthefollowingregularexpressionbefoundatthebeginningofthelineWhennotatthebeginningofaregularexpression,^standsforitself$Whenusedattheendofaregularexpression,$requiresthattheprecedingregularexpressionbefoundattheend|viandVimEditorsPocketReferenceofthelineWhennotattheendofaregularexpression,$standsforitselfTreatsthefollowingspecialcharacterasanordinarycharacterUsetogetaliteralbackslash~MatcheswhateverregularexpressionwasusedinthelastsearchMatchesanyoneofthecharactersenclosedbetweenthebracketsArangeofconsecutivecharacterscanbespecifiedbyseparatingthefirstandlastcharactersintherangewithahyphenYoucanincludemorethanonerangeinsidebracketsandspecifyamixofrangesandseparatecharactersMostmetacharacterslosetheirspecialmeaninginsidebrackets,soyoudon’tneedtoescapethemifyouwanttousethemasordinarycharactersWithinbrackets,thethreemetacharactersyoustillneedtoescapeareThehyphen()acquiresmeaningasarangespecifiertouseanactualhyphen,youcanalsoplaceitasthefirstcharacterinsidethebracketsAcaret(^)hasspecialmeaningonlywhenit’sthefirstcharacterinsidethebrackets,butinthiscase,themeaningdiffersfromthatofthenormal^metacharacterAsthefirstcharacterwithinbrackets,a^reversestheirsense:thebracketsmatchanyonecharacternotinthelistForexample,^azmatchesanycharacterthat’snotalowercaseletterCAUTIONOnmodernsystems,thelocalecanaffecttheinterpretationofrangeswithinbrackets,causingvitomatchlettersinasurprisingfashionItisbettertousePOSIXbracketexpressions(see“POSIXBracketExpressions”onpage)tomatchspecifickindsofcharacters,suchasalllowercaseoralluppercasecharactersSubstitutionandRegularExpressions|()Savesthepatternenclosedbetween(and)intoaspecialholdingspaceor“holdbuffer”YoucansaveuptoninepatternsinthiswayonasinglelineYoucanalsousethennotationwithinasearchorsubstitutestring::s(abcd)alphabetsoupchangesabcdabcdintoalphabetsoup‡<>Matchescharactersatthebeginning(<)orend(>)ofawordTheendorbeginningofawordisdeterminedeitherbyapunctuationmarkorbyaspaceUnlike(),thesedon’thavetobeusedinmatchedpairsPOSIXBracketExpressionsPOSIXbracketexpressionsmaycontainthefollowing:CharacterclassesAPOSIXcharacterclassconsistsofkeywordsbracketedby:and:Thekeywordsdescribedifferentclassesofcharacters,suchasalphabeticcharacters,controlcharacters,andsoon(seethefollowingtable)CollatingsymbolsAcollatingsymbolisamulticharactersequencethatshouldbetreatedasaunitItconsistsofthecharactersbracketedbyandEquivalenceclassesAnequivalenceclasslistsasetofcharactersthatshouldbeconsideredequivalent,suchaseandèItconsistsofanamedelementfromthelocale,bracketedby=and=Allthreeconstructsmustappearinsidethesquarebracketsofabracketexpression‡Thisworkswithvi,nvi,andVim,butnotwithelvisorvile|viandVimEditorsPocketReferencePOSIXcharacterclassesClassMatchingcharacters:alnum:Alphanumericcharacters:alpha:Alphabeticcharacters:blank:Spaceandtabcharacters:cntrl:Controlcharacters:digit:Numericcharacters:graph:Printableandvisible(nonspace)characters:lower:Lowercasecharacters:print:Printablecharacters(includeswhitespace):punct:Punctuationcharacters:space:Whitespacecharacters:upper:Uppercasecharacters:xdigit:HexadecimaldigitsMetacharactersUsedinReplacementStringsnIsreplacedwiththetextmatchedbythenthpatternpreviouslysavedby(and),wherenisanumberfromonetonine,andpreviouslysavedpatterns(keptinholdbuffers)arecountedfromtheleftonthelineTreatsthefollowingspecialcharacterasanordinarycharacterTospecifyarealbackslash,typetwoinarow()IsreplacedwiththeentiretextmatchedbythesearchpatternwhenusedinareplacementstringThisisusefulwhenyouwanttoavoidretypingtext~ThestringfoundisreplacedwiththereplacementtextspecifiedinthelastsubstitutecommandThisisusefulforrepeatinganedituorlChangesthenextcharacterinthereplacementstringtouppercaseorlowercase,respectivelySubstitutionandRegularExpressions|UorLandeorEUandLaresimilartouorl,butallfollowingcharactersareconvertedtouppercaseorlowercaseuntiltheendofthereplacementstringoruntileorEisreachedIfthereisnoeorE,allcharactersofthereplacementtextareaffectedbytheUorLMoreSubstitutionTricks•Youcaninstructvitoignorecasebytyping:setic•Asimple:sisthesameas:s~•:isthesameas:sYoucanfollowthewithgtomakethesubstitutiongloballyontheline,andevenuseitwithalinerange•Youcanusethekeyasavicommandtoperformthe:command,ie,torepeatthelastsubstitution•The:~commandissimilartothe:command,butwithasubtledifferenceThesearchpatternusedisthelastre

类似资料

该用户的其他资料

《java编程思想_第四版》_英文版.pdf

Python3程序开发指南(第二版).pdf

PostgreSQL 9 Administration Cookbook - 2010.pdf

postgreSQL参考手册.pdf

C++编程思想(第二版)第一卷中文版.pdf

职业精品

精彩专题

墨西哥——让人低估的旅游城市

墨西哥是美洲大陆上的文明古国,以阳光与热情著称,墨西哥气候宜人,风光秀丽,尤其是名胜古迹非常多。所以当您选择去墨西哥旅游时,首先要去的就是举世闻名的旅游圣地——墨西哥城。

用户评论

0/200
    暂无评论
上传我的资料

精选资料

热门资料排行换一换

  • 卓有成效的管理者_彼得·德鲁克-…

  • 惹爱成性(圣妖).txt

  • 一月剧变:超过十月革命的大事件.…

  • 俺爹俺娘:图文典藏版.pdf

  • 穿越成为霸道少爷的通房丫头+番外…

  • [中国人与日本人].松本一男.扫…

  • SAP processes in…

  • 蒋介石成败录.TXT

  • 变脸武士.txt

  • 资料评价:

    / 94
    所需积分:0 立即下载

    意见
    反馈

    返回
    顶部