Format JSON in Vim with jq
jq is a very powerful command-line tool designed to manipulate JSON data. One of its great features is that it automatically formats JSON output for better readability: $ echo '{"is_jq_awesome": true}' | jq { "is_jq_awesome": true } But in Vim? Can we utilize this inside of Vim? Of course! In Vim, there’s a feature called filter commands that enables us to use external applications to modify our buffers. Filter commands take a range, which is a set of contiguous lines, and a command that processes these lines. This feature is exactly what we need for our purpose. ...