在 Sublime Text 2/3 中为特定文件名设置语法 [英] Set syntax for a specific file name in Sublime Text 2/3

查看:38
本文介绍了在 Sublime Text 2/3 中为特定文件名设置语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,它使用一个名为 user.cfg 的文件来获取其用户定义的配置设置.奇怪的是他们选择了这个文件的语法为 Tcl(它是 Tcl 并不奇怪,奇怪的是他们选择了 .cfg 扩展名而不是 .tcl).所以,当我在 Sublime Text 中打开这个文件时,它不知道选择什么语法高亮方案.

I have a program that uses a file called user.cfg to get its user defined configuration settings. The odd thing is that they chose the syntax for this file to be Tcl (it's not odd that it is Tcl, it's odd they chose the .cfg extension instead of .tcl). So, when I open this file in Sublime Text, it doesn't know what syntax highlighting scheme to choose.

我想做的是将 user.cfg 的语法突出显示设置为 Tcl,但不是所有 .cfg 文件都设置为 Tcl.

What I would like to do is set the syntax highlighting for user.cfg to Tcl, but not all .cfg files to Tcl.

我看到了这个问题非常em> 与我的类似,除了在那种情况下特殊文件名没有扩展名,所以 Sublime Text 知道将 Ruby 突出显示分配给那个文件.不幸的是,我有一个扩展,所以那里给出的解决方案对我不起作用.

I have seen this question which is very similar to mine, except in that case the special file name had no extension so Sublime Text knew to assign Ruby highlighting to only that one file. Unfortunately, I have an extension so the solution given there will not work for me.

是否有任何已知的方法可以让 Sublime Text 基于完整文件名的突出显示方案?

Is there any known way to get Sublime Text base a highlighting scheme on the full filename?

推荐答案

查看ApplySyntax插件.

这篇关于在 Sublime Text 2/3 中为特定文件名设置语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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