Created: 2022-04-14 22:33
Reference: Integrate Shell Commands Into Vi Workflow
Vim wands allow to send the current line or section to a shell command and replace that with the command’s output.
!!<bash> # line
!}<bash>. # section
!:<lineafter><enter><bash> # from current line to <lineafter>
Examples
Formatting JSON with jq
Having the cursor in the following line:
{"foo": "bar", "baz": [1,2,3]}
Send line to jq: !!jq
. Which will replace it with:
{
"foo": "bar",
"baz": [1,2,3]
}