I wrote simple jsonview script to view json files:
#!/bin/bash
tmp_file=/tmp/jsonview.json
cat "${@}" | python -m json.tool > $tmp_file
[[ -f $tmp_file ]] && vim $tmp_file
I am not using less because I need syntax highlighting.
That useless use of cat cat ${@} | ... is so that script can be used as a filter:
jsonview t.json
and:
cat t.json | jsonview
If jsonview used as in second, pipe case - despite the fact that vim is invoked not on pipe but on concrete file, I am getting that warning in subject. I can view json file, but after exit, it messes up terminal. Why is this warning? Why vim thinks that it reads from a pipe?