# vim: Fix change surround with any brackets text object \(\#37386\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/e5a968b709feeeac1e12de054645671d64071676)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: e5a968b709feeeac1e12de054645671d64071676

Requested commit: e5a968b709feeeac1e12de054645671d64071676

Commit: e5a968b709feeeac1e12de054645671d64071676

Tree: 14054b236ac2b13439c27e13fbfc8e59ddc67a71

Author: Dino

Committer: GitHub

## Message

````
vim: Fix change surround with any brackets text object (#37386)

This commit fixes an issue with how the `AnyBrackets` object was handled
with change surrounds (`cs`). With the keymap below, if one was to use
`csb{` with the text `(bracketed)` and the cursor inside the
parentheses, the text would not change.

```json
{
  "context": "vim_operator == a || vim_operator == i || vim_operator == cs",
  "bindings": {
    "b": "vim::AnyBrackets"
  }
}
```

Unfortunately there was no implementation for finding a corresponding
`BracketPair` for the `AnyBrackets` object, meaning that, when using
`cs` (change surrounds) the code would simply do nothing.

This commit updates this logic so as to try and find the nearest
surrounding bracket (parentheses, curly brackets, square brackets or
angle brackets), ensuring that `cs` also works with `AnyBrackets`.

Closes #24439

Release Notes:

- Fixed handling of `AnyBrackets` in vim's change surrounds (`cs`)
````

## Parents

- [7aecab8e14f1abaf6ebb3b4cb3857a53b3fd29e5](https://git.cafe/gitcafe/zed/commit/7aecab8e14f1abaf6ebb3b4cb3857a53b3fd29e5?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/e5a968b709feeeac1e12de054645671d64071676?format=markdown)
