vim: Add any brackets to support motions like ab and ib to work with any type of brackets #23679
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add AnyBrackets text object for Vim mode
Overview
This PR introduces a new text object
AnyBrackets
that allows operations on the closest matching pair of brackets, regardless of the bracket type. This enhances the editing experience by reducing the need to identify specific bracket types before performing text operations.By default, this feature is NOT mapped to any key in vim.json. However, it can be enabled manually, and the recommended key for mapping is b:
If you want to add it to your zed keymap config you need to add the following config:
Features
()
, square brackets[]
, curly braces{}
, they are also know as round brackets, square brackets and curly brackets in english.i
anda
)Usage Examples
References:
Important Notes
This PR also fixes a bug with nested quotes on AnyQuotes, now it works fine with any type of quotes or brackets.
Please take a look at the new tests to understand the expected behavior.
Release Notes:
ab
/ib
"AnyBrackets" text objects that are the smallest ofa(
,a[
ora{
ori(
,i[
ori{