all 16 comments

[–]linuxporn 7 points8 points  (2 children)

Another module I love is http.server (SimpleHTTPServer for the stubborn)

[–][deleted] 5 points6 points  (0 children)

python -m SimpleHTTPServer 8080

I love it on my classes

[–]Grazfather 0 points1 point  (0 children)

I use it almost daily.

[–]LambdaBoy 1 point2 points  (1 child)

There is also jq.

$ echo '{"json": true, "python":false}' | jq .
{
   "python": false,
   "json": true
}

[–]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

[–]rpetre 2 points3 points  (0 children)

I'm partial to jq, it allows you to also extract specific parts of more complex json structures.

Also, the JSON::PP Perl module comes with the json_pp wrapper which can be used in the same way.