Send a Command's Output to Vim (Part II) ↪️
In a Hashrocket blog post, 10 Vim Commands for a Better Workflow, I wrote about
:.! <command>, which replaces the output of
<command> with your current line.
Today I learned what this technique is called: filtering. From the docs:
filter is a program that accepts text at standard input, changes it in some way, and sends it to standard output. You can use the commands below to send some text through a filter, so that it is replaced by the filter output.
An even shorter version is just
!!<command> in normal mode. A use case for this would be writing docs, where command-line output (
curl, etc.) can help demonstrate an idea.
:help !! to see all the permutations of this interesting command.