Sublime Forum

BracketHighlighter background color matching bracket

#1

Hi,

I am looking for only one thing: when the text cursor is either to left or right of a bracket that has a matching bracket, to highlight both brackets by changing the background color of each. It is acceptable to me to have the brackets highlighted whenever the text cursor is between the two.

Sublime Text accomplishes this by underlining the matching bracket. An answer in this post provides a way of doing so without plugins by modifying the .tmTheme file, which if I’ve understood correctly is now the .sublime-theme file. I have not managed to get this to work.

The BracketHighlighter plugin offers a presumably simple way of accomplishing this. I have installed the BracketHighlighter package and have it running. Currently it underlines matching brackets whenever the text cursor is between the two. Setting high_visibility_enabled_by_default = true provides a whole box around the text between the brackets; that is too much for me. What, then, is the field to edit?

As with all things computer-related, the simplest tasks can consume disproportionately too much time, and I’ve spent more than I’d like to admit on this. If anyone could help me accomplish this presumably simple feature, it would be very much appreciated.

Thanks in advance.

0 Likes

#3

Snipaste_2020-02-10_03-45-57

If the above is what you want,


  1. In BH’s core (bracket) settings, use "style": "solid", for bracket styles.
    https://github.com/jfcherng/my-Sublime-Text-settings/blob/46f5509635ca4384bace2b875227b9d5fa0c9320/Packages/User/bh_core.sublime-settings#L396-L467

  2. In your color scheme, add rules for how you want corresponding bracket scopes to look like.
    https://github.com/jfcherng/my-Sublime-Text-settings/blob/46f5509635ca4384bace2b875227b9d5fa0c9320/Packages/my_theme/my_theme.sublime-color-scheme#L757-L813

3 Likes

#4

Thank you! “Read the docs” they say, but docs ain’t easy to read. This was exactly what they I needed.

0 Likes