%resolves to the current filename.
!calls an external function. Together,
%!executes a command over the file, and replaces the current buffer with the output.
You can generate derived JSON from an existing file with
jq, which I sometimes use to generate and manipulate test vectors:
:w !jq '.key-to-filter-by' > filtered.json
You can easily pass Markdown (or any other text format) files straight through
pandoc. This is useful for exporting documentation for sharing with non-engineers.
:w !pandoc -o FILENAME.pdf
Processing can be achieved by calling
%! !external_fnto replace buffer contents in-place.
In this example, we pipe a JSON file through
:%: !jq '.'
In this example, we convert the current file from Markdown to HTML using
:%: !pandoc -f markdown -t html