246 CHAPTER 15 WORKING WITH TEXT (Web host 4 life) FILES
246 CHAPTER 15 WORKING WITH TEXT FILES Table 15-1. vi Command Mode Commands (Continued) Command Description Search / Search forward (type the search text directly after the slash) ? Search backwards n Repeat search in a forward direction N Repeat search in a backward direction Cut and Paste yy Copy the current line3 nyy Copy n number of lines into the buffer from the cursor downwards (for example, 5yy copies five lines of text) p Paste the contents of the clipboard3 Insert Text i Switch to Insert mode at the cursor o Switch to Insert mode, placing the cursor below current line O Switch to Insert mode, placing the cursor above current line A Append text to end of line Navigation4 $ Move the cursor to the end of the current line w Move the cursor to the next word b Move the cursor to the previous word Miscellaneous . Repeat the last command u Undo the last command 1 A line ends where a line-break control character occurs in the file. Because of this, a line of text may actually take up several lines of the on-screen display. 2 This will delete the remainder of current word before/after the cursor if the cursor is in the middle of a word. 3 The standard documentation refers to copying as “yanking and the clipboard as the buffer. 4 You can also use the cursor keys to move around the file and the Page Up and Page Down keys to move up and down a page at a time. Additionally, press 0 (zero) on the main keyboard, not the numeric keypad, to move the cursor to the start of the current line, or Shift+0 to move forward one sentence (until the next full stop). Insert Mode To type your own text or edit text, you need to switch to Insert mode. This is normally done by typing i, but you can also type Oor o to change to Insert mode, which is indicated by the word INSERT appearing at the bottom of the screen, as shown in Figure 15-3. The difference between