Lines Matching refs:command
9 often and turn it into a new command. Or redefine an existing command.
13 |40.2| Defining command-line commands
33 the "o" command opens a new line and starts Insert mode. The text "Date: " is
39 The ":" character takes Vim to the command line. The ":read !date" command
40 reads the output from the "date" command and appends it below the current
41 line. The <CR> is required to execute the ":read" command.
53 The ":map" command defines remapping for keys in Normal mode. You can also
77 "y", and you are expected to type the motion command or a text object. Thus
80 Suppose that you want to define <F7> so that the command d<F7> deletes a C
84 the following command: >
128 Suppose you hardly ever use Ex mode, and want to use the "Q" command to format
141 To avoid keys to be mapped again, use the ":noremap" command: >
146 it. There is a similar command for every mode:
172 where the substitute command doesn't find a match for "5.1". You can then
181 To remove a mapping use the ":unmap" command. Again, the mode the unmapping
182 applies to depends on the command used:
201 To remove all mappings use the |:mapclear| command. You can guess the
202 variations for different modes by now. Be careful with this command, it can't
208 The ":map" command can be followed by another command. A | character
210 inside a map command. To include one, use <Bar> (five characters). Example:
214 The same problem applies to the ":unmap" command, with the addition that you
220 The first command tries to unmap "a ", with a trailing space.
230 starts a new, empty command with a comment. Example: >
280 *40.2* Defining command-line commands
283 commands just like any other Command-line mode command.
284 To define a command, use the ":command" command, as follows: >
286 :command DeleteFirst 1delete
288 Now when you execute the command ":DeleteFirst" Vim executes ":1delete", which
296 To list the user-defined commands, execute the following command: >
298 :command
301 abbreviated. You need to type just enough to distinguish the command from
309 :DeleteFirst command takes no arguments, so you could have defined it as
312 :command -nargs=0 DeleteFirst 1delete
326 Inside the command definition, the arguments are represented by the
329 :command -nargs=+ Say :echo "<args>"
343 :command -nargs=+ Say :echo <q-args>
345 Now the above ":Say" command will result in this to be executed: >
352 :command -nargs=* DoIt :call AFunction(<f-args>)
355 Executes the following command: >
363 defining such a command, you need to specify a -range option. The values for
372 the first and last line in the range. For example, the following command
373 defines the SaveIt command, which writes out the specified range to the file
376 :command -range=% SaveIt :<line1>,<line2>write! save_file
383 -count={number} The command can take a count whose default is
392 -complete={type} Type of command-line completion used. See
393 |:command-completion| for the list of possible
395 -bar The command can be followed by | and another
396 command, or " and a comment.
397 -buffer The command is only available for the current
406 To redefine the same command use the ! argument: >
408 :command -nargs=+ Say :echo "<args>"
409 :command! -nargs=+ Say :echo <q-args>
411 To delete a user command use ":delcommand". It takes a single argument, which
412 is the name of the command. Example: >
427 An autocommand is a command that is executed automatically in response to some
451 With this command enabled, when you do a ":write", Vim checks for any
454 The general form of the :autocmd command is as follows: >
456 :autocmd [group] {events} {file-pattern} [++nested] {command}
460 separated) that trigger the command.
464 and finally, {command} is the command to be executed.
520 To delete an autocommand, use the same command as what it was defined with,
521 but leave out the {command} at the end and use a !. Example: >
557 command. For example, let's define autocommands for C programs: >
592 The file name must end in ".new". The ":execute" command uses expression
593 evaluation to form a new command and execute it. When editing the file
594 "tryout.c.new" the executed command will be: >
602 ":doautocmd" executes on the current buffer. The ":doautoall" command works
609 want to use a Normal mode command, the ":normal" command can be used.
616 Using the ":normal" command is a bit tricky. First of all, make sure its
617 argument is a complete command, including all the arguments. When you use "i"
621 The ":normal" command uses all the text after it as commands. Thus there
622 can be no | and another command following. To work around this, put the
623 ":normal" command inside an ":execute" command. This also makes it possible
629 This also shows the use of a backslash to break a long command into more
630 lines. This can be used in Vim scripts (not at the command line).
645 To ignore all events, use the following command: >