Use bold only for captions and for text only in exceptional cases. Blocks of bold text are more difficult to read.
Source Link

enter image description here

My problem

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

What have I tried

  • d% deletes from the cursor position onwards, till the end of the block, but keeps the subgraph 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

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? How can I delete an entire block, including the entire line in which the block starts, with any prefixes before the opening braces?

enter image description here

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 the subgraph 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?

enter image description here

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 the subgraph 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?

Source Link
Adam Matan
  • 543
  • 4
  • 13

Delete entire block, with the prefixes before the opening {

enter image description here

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 the subgraph 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?