How to change the style of matching parentheses in Sublime Text 2/3?

It simply emphasizes the matched brackets. Is it possible to make it more useful, for example, change the color of the brackets or highlight the line of brackets?

+49
sublimetext2 sublimetext sublimetext3
Apr 29 2018-12-12T00:
source share
5 answers

there is a BracketHighlighter plugin

features:

  • Custom highlighting of brackets (), [], <>, {}
  • Customizable tag highlighting (supports unary tags and supports self-closing / "> (HTML5 coming))
  • Customizable quotes highlighting
  • selectively disable or enable specific matching labels, brackets or quotes
  • Select a white or blacklist for specific language-based tags, brackets, or quotes
  • When using a shortcut on demand, the number of display lines and char counting between matching in the status bar
  • Shortcuts to move the cursor to the beginning or end of the contents in brackets (will focus on the start or end bracket if multi-user mode is not currently running)
  • Shortcut to select all contents in parentheses
  • and others, see github website.
+41
Apr 29 '12 at 12:15
source share

You can change the color of the brackets by changing the theme color scheme file.

Go to Preferences / Package Overview to open the Color Scheme folder - by default, find out the current theme file (by default Monokai.tmTheme ). Open it with Sublime Text and find the following part:

 <key>bracketsForeground</key> <string>#F8F8F2A5</string> <key>bracketsOptions</key> <string>underline</string> <key>bracketContentsForeground</key> <string>#F8F8F2A5</string> <key>bracketContentsOptions</key> <string>underline</string> 

Here you can change the appearance of your brackets. If you change it to the following:

 <key>bracketsForeground</key> <string>#FF8000</string> <key>bracketsOptions</key> <string>foreground</string> <key>bracketContentsForeground</key> <string>#FF8000</string> <key>bracketContentsOptions</key> <string>foreground</string> 

.. you remove the underline and add the orange color to your brackets.

Take a look at the rest of the file because (maybe) you will find something more to change;)

There is no need to restart the sublime to see the changes. Just save the file.

Update for Sublime Text3

  • Go to the Sublime Text 3 folder; cd to the Packages folder. Locate the Color Scheme - Default.sublime-package and copy it to the Packages folder (under the %APPDATA%\Sublime Text 3\Packages windows).
  • Decompress the file (using any unzip).
  • Access to the new generated folder and change the theme file (the same steps as in Sublime Text 2).
  • After making the changes, save the file and you will see your changes.
  • If you want, you can compress the file as zip again using the .sublime-package extension, but if you do, you must transfer this file to the Installed Packages folder.

Update 2

There's a very useful plugin editing package called PackageResourceViewer . This allows you to edit packages very easily, doing all the unpacking and moving things for you.

+68
Jun 14 2018-12-12T00:
source share

The color of the bracket and other visibility parameters can be changed without using a plug-in. The following is a method for making such changes initially.

Note: I recently wrote this @SublimeText Forum answer. There is a similar (unacceptable) answer here, but I included some non-related details and a visual link.




Example

This is my personal configuration:

Demo1

Demo2




OPTIONS

Below are all of my visibility related options.

As you can see in the examples: brackets parameters determine the color of pairs of brackets if the carriage is placed in a bracket, while the settings for bracketContents determine the color of pairs of brackets if the carriage is placed in a set of brackets.

My bracketContentsOptions set to underline , but you can change it to foreground if you want it to be highlighted in both cases.

@ Settings .sublime-settings

 "always_show_minimap_viewport" : true, "caret_extra_bottom" : 3, "caret_extra_top" : 3, "caret_extra_width" : 1, "caret_style" : "phase", "draw_minimap_border" : true, "fade_fold_buttons" : false, "fold_buttons" : true, "highlight_line" : true, "highlight_modified_tabs" : true, "line_numbers" : true, "match_brackets" : true, "match_brackets_angle" : true, "match_brackets_braces" : true, "match_brackets_content" : true, "match_brackets_square" : true, "match_selection" : true, "match_tags" : true, "overlay_scroll_bars" : "enabled", 

@ YourColorScheme.tmTheme

  <!-- Indent Guides --> <key>guide</key> <string>#14191F</string> <key>stackGuide</key> <string>#14191F</string> <key>activeGuide</key> <string>#2E4589</string> <!-- Highlighted Brackets --> <key>bracketsForeground</key> <string>#D80E64</string> <key>bracketsOptions</key> <string>foreground</string> <key>bracketContentsForeground</key> <string>#D80E64</string> <key>bracketContentsOptions</key> <string>underline</string> <!-- Document Selection --> <key>caret</key> <string>#D80E64</string> <key>lineHighlight</key> <string>#121522</string> <key>selection</key> <string>#1D416B</string> <key>selectionForeground</key> <string>#bbccff</string> <key>selectionBorder</key> <string>#4D71FF</string> <key>inactiveSelection</key> <string>#1D416B</string> <key>inactiveSelectionForeground</key> <string>#bbccff</string> <!-- Search Results --> <key>findHighlight</key> <string>#0BD0AC</string> <key>findHighlightForeground</key> <string>#000000</string> 
+10
Mar 25 '16 at 1:01
source share

With the BracketHighlighter package, edit your theme (tmTheme) and add:

  <dict> <key>name</key> <string>Tag</string> <key>scope</key> <string>brackethighlighter.default</string> <key>settings</key> <dict> <key>foreground</key> <string>#ffff00</string> </dict> </dict> 
+3
Jan 27 '15 at 21:46
source share
 <dict> <key>name</key> <string>Tag</string> <key>scope</key> <string>meta.tag, declaration.tag</string> <key>settings</key> <dict> <key>foreground</key> <string>#0033CC</string> </dict> </dict> 

This changes the colors of the brackets in sb3

+2
Sep 06 '13 at 0:50
source share



All Articles