Filter lines or execute an external command
Example
Normal 0 / 3Command-line 1 / 3Awaiting character 2 / 3Normal 3 / 3Filter lines or execute an external command.
Shell context
- shell
/bin/sh- Previous external command
printf hello
External output
- stdout
Command entered · ready to apply
Shell context
- shell
/bin/sh- Previous external command
printf hello
External output
- stdout
Command line
- Typed text
:!printf hello- Insertion offset
14
The prepared shell command printed hello; Vim waits for the shell-return acknowledgment.
Shell context
- shell
/bin/sh- Executed command
printf hello
External output
- stdout
hello
Shell return prompt
- Prompt
Press ENTER or type command to continue
The shell command prints hello while the editing buffer stays unchanged. Press Enter to return from the shell-output screen.
Shell context
- shell
/bin/sh- Executed command
printf hello
External output
- stdout
hello
Before & after
Before
Shell context
- shell
/bin/sh- Previous external command
printf hello
External output
- stdout
After
Shell context
- shell
/bin/sh- Executed command
printf hello
External output
- stdout
hello
Documentation-backed illustration. a POSIX shell with printf, unrestricted shell commands, and the shown command history (:!/:!!); this is data only. The shell command prints hello while the editing buffer stays unchanged. Primary help: :!.
alpha
beta
gammaCursor on line 1, column 1Details & Vim help
Filter lines or execute an external command. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.