如何修复vim中的JSON缩进? [英] How to fix JSON indentation in vim?
本文介绍了如何修复vim中的JSON缩进?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在vim中,JSON的默认缩进为:
In vim, the default indentation for JSON is:
{
"employees": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }
]
}
但我的期望是:
{
"employees": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }
]
}
我做谷歌并试过一些vim-json插件,但没有一个能解决这个问题。
I did google and tried some vim-json plugins, but none of them fix this issue.
推荐答案
更简单的方法是将外部命令作为选择的过滤器。例如
Easier way is to just external command as a filter for a selection. e.g.
- 进行选择
- 输入
:!python -m json。工具
- Make a selection
- Type
:!python -m json.tool
这篇关于如何修复vim中的JSON缩进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文