Vim: 'errorformat' setting for JSON syntax checker
I was inspired by Rodrigo's tip and noticed this Python module provides enough information for validating a JSON file.
I often edit JSON file as a Chef data bag, therefore I configured Vim like this:
" JSON (Chef)
autocmd BufRead,BufNewFile knife-edit-*.js,*.json setlocal filetype=javascript.json
autocmd FileType *json* setlocal makeprg=python\ -mjson.tool\ 2>&1\ %\ >\ /dev/null
\| setlocal errorformat=%m:\ line\ %l\ column\ %c\ %.%#
You can check a JSON syntax like this:
:make
Gist is also available: https://gist.github.com/4459707
Written by Tacahiroy
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#