Say I have the following python array literal:
def f():
arr = [
1,
2,
3
]
I want to delete everything in the brackets so that it becomes this:
def f():
arr = []
How can I do that with minimal commands in vim?
These are some of my attempts:
Using di]
will delete the text, but not the empty newlines, leaving a lot of whitespace I'd have to delete:
def f():
arr = [
]
Using da]
will delete the newlines, but also the brackets:
def f():
arr =
You can simply do:
ca[[]<Esc>
or:
ca][]<Esc>
See :help text-objects
.
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