Sublime Text 2中的每个令牌字体大小 [英] Per-token font size in Sublime Text 2

查看:319
本文介绍了Sublime Text 2中的每个令牌字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

道歉,如果这已经被回答,但我找不到任何重复。

是否可以在Sublime Text中以每个标记为基础设置字体大小2?例如,所有的函数标记都是大小10,而函数名是大小30?我已经做了一个我想要实现的模型:



这里的动机是让你更容易把重点放在重要的部分代码 - 特别是在浏览时。我猜想这样的事情应该是可能的,因为默认情况下,ST2已经将不同的字体应用到不同的标记(例如switchVars()中的'var'和'c = a;')。

如果它不是一个功能,ST2是否提供了将其作为插件实现的功能?非常感谢!

解决方案

不幸的是,这是不可能的,因为 API 或用于在该粒度级别处理字体大小的颜色方案。



但是,可以为您的配色方案( .tmTheme 文件)提供额外的高亮显示,以便使功能定义更加突出。看起来你正在使用Monokai,所以打开 Packages / Color Scheme - Default / Monokai.tmTheme ,并在最后加上以下内容:<$ c $

< dict>< / c>
< key>名称< / key>
< string>函数定义< / string>
< key>范围< / key>
< string> meta.function< / string>
< key>设置< / key>
< dict>
< key>背景< / key>
< string>#000080< / string>
< / dict>
< / dict>

这将以深蓝色突出显示您的函数定义行:



也适用于其他函数定义语法:




祝您好运! / p>

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:

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!

解决方案

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:

It also works for alternate function definition syntaxes:

Good luck!

这篇关于Sublime Text 2中的每个令牌字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆