Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Square bracket does not close when other closing brace is present #369

Open
ei14 opened this issue Oct 22, 2023 · 2 comments
Open

Square bracket does not close when other closing brace is present #369

ei14 opened this issue Oct 22, 2023 · 2 comments

Comments

@ei14
Copy link

ei14 commented Oct 22, 2023

Unexpected behavior occurs in the following example.

Open a file containing these 3 characters: ([). Enter insert mode so that your cursor follows after the opening square bracket. Type ].

Expected: Since the closing parenthesis ) does not form a pair with the opening square bracket [, typing a closing square bracket ] should cause a closing square bracket to appear.

Actual: The closing parenthesis is treated as forming a pair with the opening square bracket. The cursor moves past the closing parenthesis ) and no square bracket is added.

This specifically occurs with square brackets. The issue is not present with other characters, as can be shown with the following example. Open a file containing [(]. Enter insert mode after the opening parenthesis. Type a closing parenthesis. As expected, the closing parenthesis appears, resulting in [()].

I believe this is unexpected behavior because it does not appear to be documented anywhere. I scanned every occurrence in the doc file of the character ], to no avail. If I am still missing something, please let me know.

If it is an intended feature, I believe it should be documented more explicitly, and there should be an option to disable this behavior.

@LunarWatcher
Copy link

What's the output of :echo b:AutoPairs and :echo b:AutoPairsList? Is it limited to a specific filetype?

@ei14
Copy link
Author

ei14 commented Dec 3, 2023

Found the issue. There's an undocumented variable called g:AutoPairsWildClosedPair. This should be added to the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants