Say I am editing this json
{
"a": {"language": "python"},
"b": {},
"c": {"language": "java"},
"d": {"encoding": "utf-16"}
}
My cursor is at b
of "b": {}
. I want to delete till the end of current {}
block. So it'll look like,
{
"a": {"language": "python"},
"
}
Looks little odd. But explains what I want.
How can I do that in Vim?
You can use d]}
.
From :help ]}
:
*]}*
]} go to [count] next unmatched '}'.
|exclusive| motion.
The help also says that this is one of the motion's use case:
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.
for your example, d]]
works too. It is easier to press.
However, ]}
is better, since it works no matter which column the { or }
sits on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With