Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Added option to always skip over pair in front of cursor #335

Merged
merged 3 commits into from
Dec 5, 2017
Merged

Added option to always skip over pair in front of cursor #335

merged 3 commits into from
Dec 5, 2017

Conversation

reujab
Copy link
Contributor

@reujab reujab commented Dec 3, 2017

Description of the Change

This pull requests adds a new option (bracket-matcher.alwaysSkipClosingPairs) that, when enabled, will always move the cursor to the right when the cursor is behind a closing pair.

Example:
After pressing (, the editor will be (|).
After pressing ), the editor will be ()|.
After moving the cursor left, the editor will be (|) again.
After pressing ) with this option set to false, the editor will be ()|)
But if the option was true, the editor would be ()|

Alternate Designs

None

Benefits

This behavior is similar to the auto-pairs and delimitMate Vim plugins. After switching to Atom from Vim with one of those plugins, this behavior will be much more familiar.

Possible Drawbacks

None, this option is disabled by default.

Applicable Issues

None

@@ -54,11 +54,11 @@ class BracketMatcher

skipOverExistingClosingBracket = false
if @isClosingBracket(text) and nextCharacter is text and not hasEscapeCharacterBeforeCursor
if bracketMarker = _.find(@bracketMarkers, (marker) -> marker.isValid() and marker.getBufferRange().end.isEqual(cursorBufferPosition))
if (bracketMarker = _.find(@bracketMarkers, (marker) -> marker.isValid() and marker.getBufferRange().end.isEqual(cursorBufferPosition))) or @getScopedSetting("bracket-matcher.alwaysSkipClosingPairs")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conditional is getting a bit long - mind splitting it up into two lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@50Wliu done

@winstliu winstliu merged commit 32817b8 into atom:master Dec 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants