Filter the selected lines through the external command {filter}
!{filter}
Example
Visual line 0 / 2Command-line 1 / 2Normal 2 / 2pear
apple
keepCursor on line 2, column 1 · Line selectionpear
apple
keepCursor on line 1, column 1apple
pear
keepCursor on line 1, column 1Filter the selected lines through the external command {filter}.
Enter the line filter command line.
Command line
- Input
:'<,'>!
Replace the filtered lines with the assumed output.
SIMULATED filter
- Program
sort- Status
Assumed success; no program executed- Output
apple pear
Before & after
pear
apple
keepCursor on line 2, column 1 · Line selectionapple
pear
keepCursor on line 1, column 1SIMULATED filter
- Program
sort- Status
Assumed success; no program executed- Output
apple pear
ILLUSTRATION. The concrete filter is sort. Assume an available shell and a successful tool with the shown output; this data-only illustration never runs it. First two lines are selected.
Details & Vim help
Filter the selected lines through the external command {filter}. Use in Visual mode. Braced names stand for the required argument and are not typed literally. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.