删除到 vim 中当前括号块的末尾
Delete till end of current parenthesis block in vim
说我正在编辑这个json
{
"a": {"language": "python"},
"b": {},
"c": {"language": "java"},
"d": {"encoding": "utf-16"}
}
我的光标位于 "b": {}
的 b
。我想删除到当前 {}
块的末尾。所以它看起来像,
{
"a": {"language": "python"},
"
}
看起来有点奇怪。但是解释了我想要的。
如何在 Vim 中做到这一点?
您可以使用 d]}
.
来自 :help ]}
:
*]}*
]} go to [count] next unmatched '}'.
|exclusive| motion.
帮助还说这是动议的用例之一:
The above four commands can be used to go to the start or end of the current
code block. It is like doing "%" on the '(', ')', '{' or '}' at the other
end of the code block, but you can do this from anywhere in the code block.
对于您的示例,d]]
也适用。它更容易按下。
但是,]}
更好,因为无论 { or }
位于哪一列,它都有效。
说我正在编辑这个json
{
"a": {"language": "python"},
"b": {},
"c": {"language": "java"},
"d": {"encoding": "utf-16"}
}
我的光标位于 "b": {}
的 b
。我想删除到当前 {}
块的末尾。所以它看起来像,
{
"a": {"language": "python"},
"
}
看起来有点奇怪。但是解释了我想要的。
如何在 Vim 中做到这一点?
您可以使用 d]}
.
来自 :help ]}
:
*]}*
]} go to [count] next unmatched '}'.
|exclusive| motion.
帮助还说这是动议的用例之一:
The above four commands can be used to go to the start or end of the current
code block. It is like doing "%" on the '(', ')', '{' or '}' at the other
end of the code block, but you can do this from anywhere in the code block.
对于您的示例,d]]
也适用。它更容易按下。
但是,]}
更好,因为无论 { or }
位于哪一列,它都有效。