How to change style of matched brackets in Sublime Text 2 / 3?

It's just underlining the matched brackets, Is it possible to make it more useful like changing brackets colour or highlighting the line of brackets?


Solution 1:

You can change the color of the brackets modifying your theme's color scheme file.

Go to Preferences / Browse packages open folder Color Scheme - Default find out your current theme file (default's Monokai.tmTheme). Open it using 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 something like this:

<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'll remove the underline and add an orange color to your brackets.

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

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

Update for Sublime Text3

  1. Go to your Sublime Text 3 installation folder; cd into "Packages" folder. Search for Color Scheme - Default.sublime-package and copy-paste it into your Packages folder (under windows is %APPDATA%\Sublime Text 3\Packages).
  2. Decompress the file (with any unzip tool).
  3. Access the new generated folder and modify your theme's file (same steps as in Sublime Text 2).
  4. After applying your changes save the file and you'll see your changes.
  5. If you want, you can compress again the file as zip using .sublime-package extension but if you do so you must move that file to Installed Packages folder.

Update 2

There's a very usefull package for editing plugins named PackageResourceViewer. It allows you to edit packages very easily, doing all the decompress & move stuff for you.

Solution 2:

there is plugin BracketHighlighter

features:

  • Customizable highlighting of brackets (),[],<>,{}
  • Customizable highlighting of Tags (supports unary tags and supports self closing /> (HTML5 coming))
  • Customizable highlighting of quotes
  • Selectively disable or enable specific matching of tags, brackets, or quotes
  • Selectively whitelist or blacklist matching of specific tags, brackets, or quotes based on language
  • When using on demand shortcut, show line count and char count between match in the status bar
  • Shortcuts for moving cursor to beginning or end of bracketed content (will focus on beginning or end bracket if not currently multi-selecting)
  • Shortcut for selecting all of the bracketed content
  • and others, see the github site.