Lines Matching refs:to

8 In chapter 4 several ways to make small changes were explained.  This chapter
11 an external program to do really complicated things.
30 The "." command repeats the preceding change. But what if you want to do
41 Take a look at how to use these commands in practice. You have a list of
56 You start by moving to the first character of the first line. Next you
60 ^ Move to the beginning of the line.
63 $ Move to the end of the line.
65 to the end of the line.
66 j Go to the next line.
71 The "@a" command can be preceded by a count, which will cause the macro to
79 You might have the lines you want to change in various places. Just move the
80 cursor to each location and use the "@a" command. If you have done that once,
81 you can do it again with "@@". That's a bit easier to type. If you now
87 you to make any changes and then still use "@a" to replay the recorded
89 26 different command sequences to execute.
95 delete commands. This allows you to mix recording with other commands to
101 G Go to the end of the file.
107 0 Go to the start of the line.
113 commands include line breaks, adjust the last two items in the example to
119 So far we have used a lowercase letter for the register name. To append to a
121 Suppose you have recorded a command to change a word to register c. It
122 works properly, but you would like to add a search for the next word to
127 You start with "qC", which records to the c register and appends. Thus
128 writing to an uppercase register name means to append to the register with
132 example, you want to collect a sequence of lines into the a register. Yank
137 Now move to the second line, and type: >
147 The ":substitute" command enables you to perform string replacements on a
150 :[range]substitute/from/to/[flags]
152 This command changes the "from" string to the "to" string in the lines
153 specified with [range]. For example, you can change "Professor" to "Teacher"
172 to:
176 To change every occurrence on the line, you need to add the g (global) flag.
185 Other flags include p (print), which causes the ":substitute" command to print
186 out the last line it changes. The c (confirm) flag tells ":substitute" to ask
193 about to change. You get the following prompt: >
215 If you are substituting with a "from" or "to" part that includes a slash, you
216 need to put a backslash before it. A simpler way is to use another character
224 The ":substitute" command, and many other : commands, can be applied to a
230 Executes the substitute command on the lines 1 to 5. Line 5 is included.
233 A single number can be used to address one specific line: >
245 character is used for this. For example, to substitute in the lines from the
246 cursor to the end: >
250 The "%" range that we used before, is actually a short way to say "1,$", from
251 the first to the last line.
256 Suppose you are editing a chapter in a book, and want to replace all
265 range is used to search backwards. Similarly, "/^Chapter/" is used to search
299 Place the marks as mentioned in chapter 3. For example, use "mt" to mark
300 the top of an area and "mb" to mark the bottom. Then you can use this range
301 to specify the lines between the marks (including the lines with the marks): >
308 You can select text with Visual mode. If you then press ":" to start a colon
313 Now you can type the command and it will be applied to the range of lines that
317 When using Visual mode to select part of a line, or using CTRL-V to
318 select a block of text, the colon commands will still apply to whole
323 is made. Thus you can use the "'<" command to jump to position where the
328 This addresses the lines from the end of the Visual area to the end of the
334 When you know how many lines you want to change, you can type the number and
339 Now you can type the command you want to use. It will use the range "."
346 you to find a match for a pattern and execute a command there. The general
351 This is similar to the ":substitute" command. But, instead of replacing the
359 Suppose you want to change "foobar" to "barfoo", but only in C++ style
366 pattern we are looking for contains a slash, this uses the plus character to
395 left of the visual block. You start by pressing CTRL-V to enter visual block
396 mode. Now you move the cursor to define your block. Next you type I to enter
397 Insert mode, followed by the text to insert. As you type, the text appears on
399 After you press <Esc> to end the insert, the text will magically be
407 Move the cursor to the "o" of "one" and press CTRL-V. Move it down with "3j"
408 to "four". You now have a block selection that spans four lines. Now type: >
443 make a choice whether you do or don't want to append text to a short line.
445 to make the block extend to the end of each line. Using "A" now will append
446 the text to the end of each line.
455 Making the same selection by moving the cursor to the end of the longest line
462 mode to enable you to type in a string. The string will be inserted in each
474 The "C" command deletes text from the left edge of the block to the end of
476 which is added to the end of each line.
506 If you want to include characters beyond the end of the line in the
512 The command ">" shifts the selected text to the right one shift amount,
521 The shift amount is specified with the 'shiftwidth' option. To change it to
546 If you don't want the white space to be changed, use the "gJ" command.
551 When you are writing an e-mail message, you may want to include another file.
560 Move the cursor to the second line and type: >
577 What if you want to read the file above the first line? This can be done
588 To write a range of lines to a file, the ":write" command can be used.
597 you are doing and want to overwrite the file, append !: >
608 In the first section of this chapter was explained how to collect a number of
609 lines into a register. The same can be done to collect lines in a file.
614 Now move the cursor to the second line you want to collect, and type this: >
618 The ">>" tells Vim the "collection" file is not to be written as a new file,
626 automatically trimmed to fit in the window. To make this happen while
637 Now lines will be broken to take only up to 72 characters. But when you
640 To tell Vim to format the current paragraph: >
650 paragraphs. This is hard to notice!
653 are properly separated, you can use this command to format the whole file: >
657 "gg" takes you to the first line, "gq" is the format operator and "G" the
658 motion that jumps to the last line.
661 you manually select. Move the cursor to the first line you want to format.
664 If it was too long, words will be moved to the next line. The cursor moves to
665 the second line. Now you can use "." to repeat the command. Keep doing this
666 until you are at the end of the text you want to format.
671 You have text with section headers in lowercase. You want to make the word
683 You can also use "g~" to swap case. All these are operators, thus they work
686 "d", thus to delete a line you use "dd". Similarly, "gugu" makes a whole line
687 lowercase. This can be shortened to "guu". "gUgU" is shortened to "gUU" and
688 "g~g~" to "g~~". Example: >
704 following command, the unsorted file input.txt will be sorted and written to
709 Now do the same thing in Vim. You want to sort lines 1 through 5 of a file.
716 expects a motion command to follow, indicating which part of the file to
717 filter. The "5G" command tells Vim to go to line 5, so it now knows that it
718 is to filter lines 1 (the current line) through 5.
719 In anticipation of the filtering, the cursor drops to the bottom of the
737 line with the output of "date". This is useful to add a timestamp to a file.
746 'shell' specifies the program that Vim uses to execute
748 'shellcmdflag' argument to pass a command to the shell
749 'shellquote' quote to be used around the command
750 'shellxquote' quote to be used around the command and redirection
754 'shellredir' string used to write the command output into a file
761 to tune the options to make filtering work. Check the help for the options
775 below the cursor. This is similar to reading a file, except that the "!" is
776 used to tell Vim that a command follows.
777 The command may have arguments. And a range can be used to tell where Vim
796 be passed to the specified command as its standard input. The output could
817 has written. To tell Vim to redraw the screen: >