在特定点折叠JSON [英] Folding JSON at specific points

查看:127
本文介绍了在特定点折叠JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSON文件,并希望在每行中使用一个切换开关( z a )对其进行折叠,并使用一个称为subsection的键.我考虑过使用像这样的全局命令:

I have a JSON file and would like to fold it with a toggle (za) at every line with a key called subsection. I thought about using a global command like:

:g/subsection/za

但是它不起作用,因为全局命令期望将编辑功能作为第二个参数,并且 z a 未编辑.

but it doesn't work since a global command expects an editing function as the second argument, and za is not editing.

有什么想法吗?

推荐答案

怎么样::g/subsection/norm za

来自:h :g

To repeat a non-Ex command, you can use the ":normal" command: >
    :g/pat/normal {commands}

这篇关于在特定点折叠JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆