Sublime Forum

Hide text

#1

Hello, I would like to know how I can hide text.

I have latex text. I use the \index{SomeIndex!dj} or \index{MyText} (similar to those) to create an index. But I want to know how I can hide the text from my entire project, because I have many files with \index

thanks

0 Likes

#2

Maybe, I need to be more specific
I’m using Sublime Text 3 (registered)

I want to somehow, hide text that starts with \index{ and ends with }
something like
My text is ok but \index{Hideme}
that way I don’t see the index. if not change color. to something that is less distractive.

0 Likes

#3

Is there any particular reason why you want to hide everything in these tags? Because there is a lot of text?

Basically, you want to do a regular expression search with lookahead and behind groups so you only select the contents. This will do: (?<=\\index\{).*?(?=\})
Then you run “Edit > Code Folding > Fold”, or whatever key combination that is for you.

To make them visible again, run “Edit > Code Folding > Unfold All”.

0 Likes

#4

Thank you.
The reason is that there is lots of texts with that.
This is a book.

Your solution is great. Is there a way to make this part of my settings, so is the default? or code it with some type of shortcut?
maybe you can point me to a place where I can figure out how to create snippets myself.
thanks

0 Likes

#5

Hi.
I tested it.
It only selects the inner part of index, which is ok, I can fix the regular expression .

However, the code folding and unfolding did not work.

0 Likes

#6

[quote=“blues76”]Hi.
I tested it.
It only selects the inner part of index, which is ok, I can fix the regular expression .

However, the code folding and unfolding did not work.[/quote]

Well, it worked fine for me.

Fortunately, there is a package which I just approved of today to do exactly what you need: packagecontrol.io/packages/Auto%20Fold

0 Likes

#7

Thank you!

0 Likes