在 vim 中直接格式化 json 内容,其实只需要调用外部函数即可实现。在 .vimrc 中添加: nmap <Leader>jf :%!python -m json.tool<cr> 使用 <Leader>jf 即可对文件内的json进行格式化显示。 image.png