Format JSON
:%!python -m json.tool
1. define custom function and use it
define function in .vimrc
function! FormatJSON()
:%!python -m json.tool
endfunction
use it in visual mode
:call FormatJSON()
2. map shortcut Ctrl + j
define command in .vimrc
nnoremap <C-j> :call Compile()<CR>
use it with Ctrl + j
in normal mode
3. map shortcut =j
nmap =j :%!python -m json.tool<CR>
use it with =j
in normal mode