Skip to content

Instantly share code, notes, and snippets.

@christoomey
Last active January 4, 2018 18:24
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christoomey/880c87192c8f005bcdb5 to your computer and use it in GitHub Desktop.
Save christoomey/880c87192c8f005bcdb5 to your computer and use it in GitHub Desktop.
Configuration for better JSON editing in Vim

Install jsonlint to act as syntastic json checker:

$ npm install jsonlint -g

Tell syntatastic about it:

" in your ~/.vimrc
let g:syntastic_json_checkers = ['jsonlint']

Get some syntax highlighting (also covers ftdetect to set json filetype)

" in your ~/.vimrc
Bundle 'elzr/vim-json'

" Disable fancy concealing of attribute quotes.
let g:vim_json_syntax_conceal = 0
@treasonx
Copy link

Pretty Print JSON

I used to work with large JSON objects and pretty printing within vim was nice.

Install jsontool to make working with JSON easier:

npm install jsontool -g

Add this awesome vim function to your vimrc!

function! PrettyJSON()
  :%!json
  set filetype=json
endfun
:command! PrettyJSON :call PrettyJSON()

@christoomey
Copy link
Author

The vim-json plugin just updated with a fix for the Undefined variable: g:vim_json_warnings. elzr/vim-json#32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment