Home Download Buy Blog Forum Support

Is 'Syntax' Highlighing without synatx possible?

Is 'Syntax' Highlighing without synatx possible?

Postby efty.edge on Tue Apr 23, 2013 12:41 pm

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...? ;)

Thanx in advance
Efty
efty.edge
 
Posts: 2
Joined: Tue Apr 23, 2013 12:33 pm

Re: Is 'Syntax' Highlighing without synatx possible?

Postby FichteFoll on Tue Apr 23, 2013 5:44 pm

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

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


Hope I didn't get the numbers wrong.
See http://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".
FichteFoll
 
Posts: 388
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: Is 'Syntax' Highlighing without synatx possible?

Postby efty.edge on Thu May 02, 2013 10:12 am

@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
Code: Select all
"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
efty.edge
 
Posts: 2
Joined: Tue Apr 23, 2013 12:33 pm

Re: Is 'Syntax' Highlighing without synatx possible?

Postby FichteFoll on Thu May 02, 2013 5:26 pm

Try this one: https://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": [...]`.
FichteFoll
 
Posts: 388
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 31 guests