[ Pobierz całość w formacie PDF ]
.INTRODUCTION TO VIvi not only allows you to undo changes, it can reverse the undo.Using the command 5dd delete5 lines then restore the lines with u.The changes can be restored by the u again.vi o ers commands which allowchanges to the text to be made without rst deleting then typingin the new version.rc Replace the character under the cursor with cMoves cursor right if repeat modifier used eg 2rcR Overwrites the text with the new textcw Changes the text of the current wordc$ Changes the text from current position to end of the linecnw Changes next n words.same as ncwcn$ Changes to the end of the nth lineC Changes to the end of the line same as c$cc Changes the current lines Substitutes text you type for the current characterns Substitutes text you type for the next n charactersThe series of change commands which allow a string of characters to be entered are exited withthe ESC key.The cw command started from the current location in the word to the end of the word.Whenusing a change command that speci es a distance the change will apply.vi will place a $ at thelast character position.The new text can over ow or under ow the original text length.A.4.3 Copying and Moving sections of textMoving text involves a number of commands all combined to achieve the end result.This sectionwill introduce named and unnamed bu ers along with the commands which cut and paste the text.Coping text involves three main steps.1.Yanking copying the text to a bu er.2.Moving the cursor to the destination location.3.Pasting putting the text to the edit bu er.To Yank text to the unnamed use y command.yy Move a copy of the current line to the unnamed buffer.Y Move a copy of the current line to the unnamed buffer.nyy Move the next n lines to the unnamed buffernY Move the next n lines to the unnamed bufferyw Move a word to the unnamed buffer.ynw Move n words to the unnamed buffer.nyw Move n words to the unnamed buffer.y$ Move the current position to the end of the line. A.4.ADVANCED VI TUTORIAL 139The unnamed bu er is a tempory bu er that is easily currupted by other common commands.On occations the text my be needed for a long period of time.In this case the named bu ers wouldbe used.vi has 26 named bu ers.The bu ers use the letters of the alphabet as the identi cationname.To distinguish the di erence between a command or a named bu er, vi uses the " character.When using a named bu er by the lowercase letter the contents are over written while the uppercaseversion appends to the current contents."ayy Move current line to named buffer a."aY Move current line to named buffer a."byw Move current word to named buffer b."Byw Append the word the contents of the named buffer b."by3w Move the next 3 words to named buffer b.Use the p command to paste the contents of the cut bu er to the edit bu er.p Paste from the unnamed buffer to the RIGHT of the cursorP Paste from the unnamed buffer to the LEFT of the cursornP Paste n copies of the unnamed buffer to the LEFT of the cursor"ap Paste from the named buffer a RIGHT of the cursor."b3P Paste 3 copies from the named buffer b LEFT of the cursor.When using vi within an xterm you have one more option for copying text.Highlight the sectionof text you wish to copy by draging the mouse cursor over text.Holding down the left mouse buttonand draging the mouse from the start to the nish will invert the text.This automatically places thetext into a bu er reserved by the X server.To paste the text press the middle button.Remmemberthe put vi into insert mode as the input could be interpreted as commands and the result will beunknown.Using the same techinque a single word can be copied by double clicking the left mousebutton over the word.Just the single word will be copied.Pasting is the same as above.The bu ercontents will only change when a new highlighted area is created.Moving the text has three steps.1.Delete text to a named or unnamed bu er.2.Moving the cursor the to destination location.3.Pasting the named or unnamed bu er.The process is the same as copying with the change on step one to delete [ Pobierz całość w formacie PDF ]
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • agnieszka90.opx.pl