How to auto format JSON on save in Vim
In one command, try this: execute ‘%!python -m json.tool’ | w You could then add you own key binding to make it a simpler keystroke. Of course, for this to work, you need to have Python installed on your machine.