Vim Recall繁體中文

Filter lines or execute an external command

:!

Example

Normal 0 / 3

Filter lines or execute an external command.

Shell context

shell
/bin/sh
Previous external command
printf hello

External output

stdout
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: :!.

Sample buffer
alpha
beta
gamma
Cursor on line 1, column 1
Details & 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.