Question: My cursor is at `H`

```
{
  //foo
  {
    //bar
    {
      //cursor is Here
    }
    //bar2
  }
}

```

How do I delete the outer layer of brackets while keeping the layer where my cursor is intact? End result should be:

```
{
  //foo
  {
    //cursor is Here
  }
}

```

Same question for `foo(bar(/*cursor is Here*/))` => `foo(/*cursor is Here*/)`

For the first part I think it should start with `2[{dt{` but that doesn't work.

My hacky solution for the 2nd(parenthesis) part: `2[(dt(%dt)` or `2[(dt(%x` if there is nothing between the last two parenthesis. Is there a better way?

Answer: 
Delete a Block, delete a Block into a black hole register, Paste:

```
daB"_daBP

```

Almost what you want, cursor position would be different in the end.

To fix indentation, do `=aB`

For the second case, you could use almost the same:

```
dab"_dabp

```
Building up on [Maxim Kim's answer](https://vi.stackexchange.com/a/27947/18609), you can use `dVaB` to delete a block in "linewise" mode (see [`:help o_V`](https://vimhelp.org/motion.txt.html#o_V)), and you can use [`]p`](https://vimhelp.org/change.txt.html#%5Dp) to put the block while adjusting the indent to match the current line. (You should do that from the `//foo` line.

An alternative to using the black hole register `"_` for the second deletion is to use numbered register [`"2`](https://vimhelp.org/change.txt.html#quote2) when you put.

Putting it all together:

```
dVaBdVaBk"2]p

```

The `k` is needed after the second block deletion because the cursor will be on the `{` line, so you'll want to move up to the `//foo` one before you put, in order to get the correct indentation.