Sublime Forum

BracketHighlighter

#122

Hello!, previously in the past ST2 version, the bracket/character was highlighted when clicking to the right of it, like this: “)|”, now this will trigger to search the bracket to the right of it, instead of the clickedone … ahh! Is there any setting to return to the old behaviour? It was more user-friendly. :unamused:
Thanks for great package!

0 Likes

#123

[quote=“tito”]Hello!, previously in the past ST2 version, the bracket/character was highlighted when clicking to the right of it, like this: “)|”, now this will trigger to search the bracket to the right of it, instead of the clickedone … ahh! Is there any setting to return to the old behaviour? It was more user-friendly. :unamused:
Thanks for great package![/quote]

When I completely re-wrote the plugin to add in custom brackets, that feature didn’t get carried over, but it is on my list of things to look into bringing back. I had kind of grown to like it working only from within the brackets, but I understand that is a personal preference.

I’ve been pretty busy, but hopefully sometime soon, I can take a look at plugin issues and start working through them again.

0 Likes

#124

I am trying to add latex tables and figures as brackets but somehow it’s not working. Here is my attempt:

{ "name": "latex_floats", "open": "(\\begin\\{sidewaystable\\})", "close": "(\\end\\{sidewaystable\\})", "style": "default", "scope_exclude": "string", "comment"], "language_filter": "whitelist", "language_list": "LaTeX"], "enabled": true }

As a result, I only get the \end{sidewaystable} sourrounded with a black line and a ? indicating that ST is unable to find the opening bracket. Any idea why?

One more questions: If this works, I would like to extend it to something like “open”: “(\begin\{(table|sidewaystable|figure|sidewaysfigure|algorithm)\})”. But I don’t think that works because only one captureing group is allowed. That is the alternative? That’s a simple regex question, I guess.

0 Likes

#125

[quote=“gregor.hoch”]One more questions: If this works, I would like to extend it to something like “open”: “(\begin\{(table|sidewaystable|figure|sidewaysfigure|algorithm)\})”. But I don’t think that works because only one captureing group is allowed. That is the alternative? That’s a simple regex question, I guess.
[/quote]

You can use non-capturing groups: (?:something|something else|etc). You need one and only one capturing group, but you can have as many non-capturing groups as you need.

If you are still having trouble, please provide some example Latex Code I can test with. I don’t use every language, so I always ask people provide me with example code, a clear explanation of what the they want BH to highlight, and their best attempting at creating the rules and/or scripts needed. This helps save me time.

0 Likes

#126

You can use non-capturing groups: (?:something|something else|etc). You need one and only one capturing group, but you can have as many non-capturing groups as you need.

If you are still having trouble, please provide some example Latex Code I can test with. I don’t use every language, so I always ask people provide me with example code, a clear explanation of what the they want BH to highlight, and their best attempting at creating the rules and/or scripts needed. This helps save me time.[/quote]

Yes, of course. Here is some code

[code]\begin{sidewaystable}
\caption{this is a sidewaytable}

\end{sidewaystable}

\begin{table}
\caption{this is a table}

\end{table}

\begin{figure}
\caption{figure}

\end{figure}[/code]

And my is modified entry in the brackets array in bh_core.sublime-settings.

{ "name": "latex_floats", "open": "(\\begin\\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\\})", "close": "(\\end\\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\\})", // "open": "(\\begin\\{sidewaystable\\})", // "close": "(\\end\\{sidewaystable\\})", "style": "default", "scope_exclude": "string", "comment"], "language_filter": "whitelist", "language_list": "LaTeX"], "enabled": true }

I would like to highlight
\begin{sidewaystable}…\end{sidewaystable}
\begin{table}…\end{table}
\begin{figure}…\end{figure}

But I only get the \end{..} sourrounded with a black line and a ? indicating that ST is unable to find the opening bracket. Any idea why?

Thanks!

0 Likes

#127

The problem was simply you have to escape backslashes in regex but also escape backslashes in the JSON settings strings as well, which can cause slightly unintuitive escapeing:

So you want this:

\\begin\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\})

So you but this in your settings:

\\begin\\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\\})

but when the regex is read in from the JSON setting string, the regex looks like this:

\begin\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\})

So basically “\begin” wasn’t sufficiently escaped in the JSON setting string to translate to an appropriate escaped regex…I know, I know this is the convoluted stuff that happens when you represent a regex expression in a string.

This is what you need:
[pre=#252525] {
“name”: “latex_floats”,
“open”: “(\\begin\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\})”,
“close”: “(\\end\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\})”,
// “open”: “(\begin\{sidewaystable\})”,
// “close”: “(\end\{sidewaystable\})”,
“style”: “default”,
“scope_exclude”: “string”, “comment”],
“language_filter”: “whitelist”,
“language_list”: “LaTeX”],
“enabled”: true
},[/pre]

0 Likes

#128

(Failed to post the first time, trying again?)
Hello!
I’m sorry if it has been asked before, but I was playing with bracket highlighter (I’m still learning Sublime Text itself) and I was wondering if it was possible to only highlight the bracket itself, not the block as a whole…

Desired: (from Vim)

Actual: (from sublime)

0 Likes

#129

@Voaxeyr The readme explains all of this here: github.com/facelessuser/Bracket … ight-style

But to directly answer your question, you can copy the bh_core.sublime-settings file to your Packages/User folder and change the default to solid like shown below:

[pre=#252525] “default”: {
“icon”: “dot”,
“color”: “brackethighlighter.default”,
“style”: “solid”
},[/pre]

If you want to change a specific bracket to be this way, and others to be different, you can can tweak them on an individually; all of this is covered in the readme.

0 Likes

#130

Is there any website with style examples ? I see there’s a lot nice color schemes, no need to make it from scratch.

0 Likes

#131

@ceroz, I am not entirely sure what you mean; can you elaborate?

0 Likes

#132

I like your bh style:

I am looking for something similar but exactly the same characters on margin:
()
|
|
|
()

I would like to get some ready to use codes for styling my BH plugin :wink:

0 Likes

#133

I’m right thinking that is not possible to install correctly the package with package control 2?
I had have to git clone and then switch to bh2st3

0 Likes

#134

[quote=“ceroz”]

I like your bh style:

I am looking for something similar but exactly the same characters on margin:
()
|
|
|
()

I would like to get some ready to use codes for styling my BH plugin :wink:[/quote]

It was a proof of concept, but it isn’t a practical style. I think I outline a number of the issues with it in the same post.

[quote=“tito”]I’m right thinking that is not possible to install correctly the package with package control 2?
I had have to git clone and then switch to bh2st3[/quote]

Works fine with Package Control 2. It is all setup in PC 2 to download the appropriate branch. The thing is, you must delete the unpacked version from your Packages folder, or it will override your Installed Packages version (the archived sublime-package version).

0 Likes

#135

It turns out there was some hard-coded setting in my Package Control.sublime-settings file that prevented this package from being installed correctly.
After cleaning /User/PAckageControl.sublime-settings most of the setttings, the package install correctly. Thanks ! and sorry for the false alarm. :blush: :stuck_out_tongue:

0 Likes

#136

[quote=“tito”]It turns out there was some hard-coded setting in my Package Control.sublime-settings file that prevented this package from being installed correctly.
After cleaning /User/PAckageControl.sublime-settings most of the setttings, the package install correctly. Thanks ! and sorry for the false alarm. :blush: :stuck_out_tongue:[/quote]

No worries, I had the same thing happen to me with a couple of plugins.

0 Likes

#137

I’m curious if anyone figured out a way to change the solid style highlight border. Currently, mine is this nasty lime green color; which doesnt match anything in my theme.

Also, why do I lose all coloring with the solid style highlight? Variables, operators, basically everything just turns to monochrome for everything within the brackets.

BTW: Thanks for the great plugin!

[quote=“rooc”]Hi, thank you for your nice package! One question - is there a way to change color for highlight border? with option “underline” and “outline” color applies to border and it’s fine but type “solid” doesn’t give a way to define border color

grab.by/bVsO[/quote]

0 Likes

#138

The borders of solid highlights are not accessible via the API, so there isn’t really a way to customize it. I think you can turn off the border (if I remember correctly), but then the selections just look blocky.

0 Likes

#139

Thanks for the reply. I really appreciate it! One more question…
Is there a way to specify minimum number of lines (or characters) threshold?

I dont want it to highlight brackets that are too close together. Its kind of distracting, and not necessary since it’s obvious where they are already. I just want it to highlight brackets that are further apart, if possible.

0 Likes

#140

Not currently. If I can get it in without mucking up anything else, I wouldn’t mind doing it. Please create a github issue at the repo.

0 Likes

#141

Done! Thanks.

0 Likes