Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
451 views
in Technique[技术] by (71.8m points)

themes - Per-token font size in Sublime Text 2

Apologies if this has already been answered but I couldn't find any duplicates.

Is it possible to set font sizes on a per-token basis in Sublime Text 2? For example, all 'function' tokens would be size 10 whereas 'functionName' would be size 30? I've put together a rough mock-up of what I want to achieve:

Mockup of per-token font-sizes in Sublime Text 2

The motivation here is to make it easier for you to focus on the important parts of your code - especially when skimming. I would suspect that such a thing should be possible given that, by default, ST2 already applies different fonts to different tokens (e.g. 'var' vs. 'c = a;' in switchVars()).

If it is not a feature, does ST2 provide the ability to implement this as a plugin? Thanks a lot!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Unfortunately, this is not possible, as there are no directives in the API or in color schemes for dealing with font size at that level of granularity.

However, it is possible to provide additional highlighting to your color scheme (.tmTheme file) so that function definitions stand out. It looks like you're using Monokai, so open Packages/Color Scheme - Default/Monokai.tmTheme and add the following to the end, just before the final </array>:

        <dict>
            <key>name</key>
            <string>Function definition</string>
            <key>scope</key>
            <string>meta.function</string>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#000080</string>
            </dict>
        </dict>

This will highlight your function definition lines in a dark blue:

monokai highlight

It also works for alternate function definition syntaxes:

jquery1 jquery2

Good luck!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...