My problem
Consider a code block prefixed with a few words (function name, for example). The vim cursor is in the middle of the prefix word. The line ends with a {
, which declares a block which spans a few more lines, till a matching }
.
I would like to delete the entire block - from the line marked as "24" to the line marked as "7".
What have I tried
d%
deletes from the cursor position onwards, till the end of the block, but keeps thesubgraph c
part intact.d8d
works, but I need to know how many lines does the block span.d%dd
works, but I hope there's a more elegant way that I'm missing
My Question
How can I delete an entire block, including the entire line in which the block starts, with any prefixes before the opening braces?
relativenumber
, so you do know how many lines the block spans. Why do you not want to use a feature you have specifically enabled (by default it is turned off)? Btw I would press8dd
(i.e. delete 8 lines).