colors - How can I change text colour in sublime text? -
i want color source code want. example, if have code
<script> var x = 1; function yu() { document.getelementbyid("e").innerhtml = "o"; } </script>
i want color whole function ( lines 3,4,5), or color line or word. don't want sublime text color every word depending of type of words.
if cant done in sublime text, know other source code editros or ide that?
you can write custom syntax
meets criteria , set default syntax filetypes wish affect.
here basic syntax example affects files extension .myextension
save following code @:
packages/mysyntaxfiles/mycustomsyntax.sublime-syntax
%yaml 1.2 --- name: mycustomsyntax file_extensions: [ myextension ] scope: source.myscopename contexts: main: - match: '\bfunction.*?{' push: function - match: '\b<.+?>\b' scope: entity.name.tag function: - meta_scope: entity.name.function - include: braces braces: - match: '{' push: braces - match: '}' pop: true
note: this example meets minimal requirements of code sample provided. need elaborate upon template in order meet actual usage requirements.
resources:
sublimetext > official documentation > syntax
sublimetext > unofficial documentation > syntax definitions
scopehunter
use find scopes might want replicate
packageresourceviewer
use open existing sublime-syntax
files reference
color schemes
browse included tmtheme
files view commonly used scopes.
maximum customization: create own tmtheme
file match syntax & scopes.
regexr
you need basic knowledge of regex
in order define scope matches.
regexr has excellent reference
section covers of basics, along testing area can try things out learn.
Comments
Post a Comment