Sublime Forum

Is 'Syntax' Highlighing without synatx possible?

#1

Hi.

First i must say, that i’m new to sublime text and i’m very impressed about the speed and the lot of features.

But let me ask you a question. I’m working with very large ASCII plain text files with more than 150.000 rows with above 800 characters each row. Is it possible to create a kind of syntax highlighter which highlights the e. g. 76 to 112 and 556 to 562 characters in each line?

I don’t now how i could better explain it…? :wink:

Thanx in advance
Efty

0 Likes

#2

76 to 112 and 556 to 562:

  • 0 to 76: nothing

  • 77 to 112: “string”

  • 113 to 556: nothing

  • 557 to 562: “string”

  • 563 to *: nothing

{ "match": "^(.{,76})(.{,36})(.{,444})(.{,6})(.*)$", "captures": { "2": {"name": "string"}, "4": {"name": "string"} } }

Hope I didn’t get the numbers wrong.
See docs.sublimetext.info/en/latest/ … xdefs.html for information about syntax definitons.

Another option would be to implement this as a plugin. The API function in question is “view.add_regions”.

0 Likes

#3

@FichteFoll

Sorry for my late replay, but i was in hospital.

Nevertheless - thank you very, very for your help. Your advice works perfectly for my needs!

But there is a small cosmetic behavior. I use "highlight_line": true,, and in the active line the syntax highlighting with your regex code is disabled until i leave the line. In case of a normal syntax like Python the highlighted line shows the colored code!

Thanx again
Efty

0 Likes

#4

Try this one: gist.github.com/FichteFoll/5503615

Also you might want to look at “View -> Ruler” or edit the ruler setting manually if you want more than one (can be done by project, by syntax, by file or globally). Setting is "rulers": ...].

0 Likes