Lines Matching refs:command
16 |10.4| The global command
30 The "." command repeats the preceding change. But what if you want to do
31 something more complex than a single change? That's where command recording
34 1. The "q{register}" command starts recording keystrokes into the register
39 You can now execute the macro by typing the command "@{register}".
70 command "@a" three times.
71 The "@a" command can be preceded by a count, which will cause the macro to
80 cursor to each location and use the "@a" command. If you have done that once,
89 26 different command sequences to execute.
121 Suppose you have recorded a command to change a word to register c. It
141 Repeat this command for all lines. The a register now contains all those
147 The ":substitute" command enables you to perform string replacements on a
148 whole range of lines. The general form of this command is as follows: >
152 This command changes the "from" string to the "to" string in the lines
154 in all lines with the following command: >
159 The ":substitute" command is almost never spelled out completely.
163 The "%" before the command specifies the command works on all lines. Without
167 By default, the ":substitute" command changes only the first occurrence on
168 each line. For example, the preceding command changes the line:
177 The command: >
185 Other flags include p (print), which causes the ":substitute" command to print
209 The "from" part of the substitute command is actually a pattern. The same
210 kind as used for the search command. For example, this command only
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.
231 The range is always placed before the command.
238 them work on the current line the "." address is used. The ":write" command
259 first column. This command will work then: >
268 substitute command here. A slash or another character would have worked as
274 There is a slight error in the above command: If the title of the next chapter
309 command, you will see this: >
313 Now you can type the command and it will be applied to the range of lines that
323 is made. Thus you can use the "'<" command to jump to position where the
339 Now you can type the command you want to use. It will use the range "."
343 *10.4* The global command
345 The ":global" command is one of the more powerful features of Vim. It allows
346 you to find a match for a pattern and execute a command there. The general
349 :[range]global/{pattern}/{command}
351 This is similar to the ":substitute" command. But, instead of replacing the
352 matched text with other text, the command {command} is executed.
355 The command executed for ":global" must be one that starts with a
357 command can do this for you.
360 comments. These comments start with "//". Use this command: >
367 separate the pattern. Next comes the substitute command that changes "foobar"
369 The default range for the global command is the whole file. Thus no range
372 The command isn't perfect, since it also matches lines where "//" appears
385 There is something special about using the "$" command in Visual block mode.
386 When the last motion command used was "$", all lines in the Visual selection
388 shorter. This remains effective until you use a motion command that moves the
394 The command "I{string}<Esc>" inserts the text {string} in each line, just
430 Now use the command "Ivery <Esc>". The result is:
439 insert command and affects only the first line of the block.
441 The "A" command works the same way, except that it appends after the right
454 This really requires using the "$" command. Vim remembers that it was used.
461 The Visual block "c" command deletes the block and then throws you into Insert
474 The "C" command deletes text from the left edge of the block to the end of
497 To fill the whole block with one character, use the "r" command. Again,
512 The command ">" shifts the selected text to the right one shift amount,
526 The "<" command removes one shift amount of whitespace at the left
527 edge of the block. This command is limited by the amount of text that is
534 The "J" command joins all selected lines together into one line. Thus it
539 using the "J" command:
543 The "J" command doesn't require a blockwise selection. It works with "v" and
546 If you don't want the white space to be changed, use the "gJ" command.
552 This can be done with the ":read {filename}" command. The text of the file is
574 The ":read" command accepts a range. The file will be put below the last line
579 error message when using it with most commands. But this command is allowed:
588 To write a range of lines to a file, the ":write" command can be used.
601 CAREFUL: The ! must follow the ":write" command immediately, without white
602 space. Otherwise it becomes a filter command, which is explained later in
610 Write the first line with this command: >
631 You might remember that in the example vimrc file this command was used for
644 This starts with the "gq" command, which is an operator. Following is "ap",
653 are properly separated, you can use this command to format the whole file: >
662 Start with the command "gqj". This formats the current line and the one below
665 the second line. Now you can use "." to repeat the command. Keep doing this
684 with any motion command, with text objects and in Visual mode.
697 still be something that an external command can do better or faster.
698 The command "!{motion}{program}" takes a block of text and filters it
699 through an external program. In other words, it runs the system command
701 as input. The output of this command then replaces the selected block.
703 a look at an example. The sort command sorts a file. If you execute the
704 following command, the unsorted file input.txt will be sorted and written to
711 command: >
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
721 program, in this case "sort". Therefore, your full command is as follows: >
735 The "!!" command filters the current line through a filter. In Unix the "date"
736 command prints the current time and date. "!!date<Enter>" replaces the current
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
752 'shellslash' use forward slashes in the command (only for
754 'shellredir' string used to write the command output into a file
774 The output of the "ls" or "dir" command is captured and inserted in the text,
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
783 (Well, if you have a date command that accepts the "-u" argument.) Note the
790 The Unix command "wc" counts words. To count the words in the current file: >
794 This is the same write command as before, but instead of a file name the "!"
795 character is used and the name of an external command. The written text will
796 be passed to the specified command as its standard input. The output could
801 The "wc" command isn't verbose. This means you have 4 lines, 47 words and 249
814 If the external command produced an error message, the display may have been