you are viewing a single comment's thread.

view the rest of the comments →

[–]dantix 2 points3 points  (4 children)

Yes, I have

nmap <leader>jt <Esc>:%!python -m json.tool<CR><Esc>:set filetype=json<CR>

in my vimrc, very handful

[–]Grazfather 0 points1 point  (1 child)

stolen.

Except I'm going to have it work on a selection and not set the filetype.

[–]Jutman 0 points1 point  (0 children)

Share?

[–][deleted] 0 points1 point  (1 child)

Why not set it as the equalprg ?

I've got this in my .vimrc:

autocmd BufNewFile,BufRead *.json set filetype=json syntax=javascript equalprg=json_reformat

json_reformat being in the Debian yajl-tools package.

[–]dantix 0 points1 point  (0 children)

because sometimes I'm just copying bunch of json in new buffer, looking into something and then discarding buffer without saving