Is it possible to match brackets like this in Sublime Text 3? if anyone know how to do it please help … thanks in advance
Bracket Match
It’s possible. BracketHighlighter allows for doing custom brackets and such. I purposely make it so it doesn’t highlight the entire tag, but you could take the existing tag bh_plugin
and adjust it to do the entire tag.
Hey, thanks for your reply but i already tried this plugin and it didn’t give me the effect i want (as shown in attached image)
I mentioned that it doesn’t do it, but you could modify the tag module to do so locally.
BH let’s you write your own modules, so you can override the tag one that is used.
This won’t quite have the same effect, but you could customize your color scheme and tweak the tag highlighting settings:
{
"globals": {
"tags_foreground": "#FF0000",
}
}
Edit: FWIW, I also use BracketHighlighter in addition to color scheme tweaks.
Steps to alter BH, if you wanted to go this route:
-
Copy the following module to
User/bh_modules/tags.py
: https://github.com/facelessuser/BracketHighlighter/blob/master/bh_modules/tags.py -
Modify this function like so:
def highlighting(view, name, style, left, right): """Highlight only the tag name.""" tag_settings = sublime.load_settings("bh_tag.sublime-settings") match_style = tag_settings.get("tag_style", {}).get(last_mode, None) # if match_style is not None and style == match_style: # tag_name = tag_settings.get('tag_name', {}).get(last_mode, r'[\w\:\.\-]+') # if left is not None: # region = view.find(tag_name, left.begin) # left = left.move(region.begin(), region.end()) # if right is not None: # region = view.find(tag_name, right.begin) # right = right.move(region.begin(), region.end()) return left, right ```
-
Then override the original module with your custom module in
bh_core.sublime-settings
"user_brackets": [ { "name": "angle", "plugin_library": "User.bh_modules.tags" }, ],
-
Update highlight style for
tag
inbh_core.sublime-settings
:// Define region highlight styles "user_bracket_styles": { "tag": { "style": "solid" } }