0

Since the text search highlights the text it's actually pretty easy to search for text in long texts in the little scroll bar. Though I have the small gripe of not being able to see small texts in there along with all the text.

While it's easy to see a long text like "Hello, I'm a long sentence made for an example's sake." it's really hard to see something like "Hi!" when the text is long enough.

Right now I have several 6000+ lines of code and I really need to see specific magic numbers in them like "24" or "16" but it's almost impossible to tell from the little scroll bar, so I have to go between them by actually searching for them. This has the huge disadvantage of missing some relevant code in between.

Anyway, like I said, I'd like to be able to see the line and the text highlighted separately if possible. If not, I'll settle on highlighting just the line.

Notes:

  • This is different to this question which asks for a way to filter lines. I want to see the lines better but not take them out of the text I'm currently reading.

  • I really don't mind whether I need to use version 2 or version 3 of sublime text for this. I'll use whichever version I need to or adapt the method to the version I'm already using.

  • I don't want to select the lines, I want to see them as searches so long as the little search window at the bottom is open. I need to be able to do edits as I see fit for any lines around the searched line not just the line itself.

1
  • I'm not sure on the tag text-formatting here so, feel free to edit (or suggest edits) for tags etc. if it's at all needed. Jun 2, 2017 at 6:02

1 Answer 1

3

i dont think there is a setting for this per se, if anyone else knows one i would love to hear it. however, we can use regular expressions in sublime.

so what we do is open the finder, the search bar along with options will show up at the bottom. we look for the button on the bottom left that says use regular expressions.

then we enter something like this: ^.*selection.*$ where selection is the thing you are looking for. this will tell sublime to search for any line containing the search term. and thus will highlight it.

hope this helps!

EDIT: in your case you might also benefit from alternate selections. so instead of looking for only one thing ever, you might like to find all lines at once. use this in that case ^.*\b(select1|sel3ct2|select3)\b.*$ same idea as before, except we say i want you to match any one of these words in a line, then get the whole line. to add additional search terms simply go inside the smooth braces () place a pipe | after the last word, and add another.

3
  • 1
    I've got Atom, I cannot test this on Sublime, but... beginning of line ^ and eol $ are not needed in case . doesn't match newline, and greediness is default.
    – SΛLVΘ
    Jun 4, 2017 at 11:27
  • @SΛLVΘ you are indeed correct. confirmed in sublime as well. thanks :)
    – Nalaurien
    Jun 4, 2017 at 11:43
  • Forgot I even asked this. Sorry about that. I've picked this answer since it seems it's the closest to what I wanted and it's also the only answer in 3 years, so... Oct 23, 2020 at 7:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .