在 Sublime Text 2 中将默认语法设置为不同的文件类型 [英] Set default syntax to different filetype in Sublime Text 2

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

问题描述

如何在 Sublime Text 2 中为某个文件扩展名设置默认文件类型?具体来说,我希望 *.cfg 文件默认具有 Ini 语法突出显示,但我似乎无法弄清楚如何创建此自定义设置.

How do I set a default filetype for a certain file extension in Sublime Text 2? Specifically I want to have *.cfg files default to having Ini syntax highlighting but I cannot seem to figure out how I could create this custom setting.

推荐答案

在当前版本的 Sublime Text 2 (Build: 2139) 中,您可以使用菜单中的选项为特定文件扩展名的所有文件设置语法酒吧.打开带有您要为其设置默认扩展名的文件并浏览以下菜单:View ->语法 ->打开所有当前扩展为... ->[你的语法选择].

In the current version of Sublime Text 2 (Build: 2139), you can set the syntax for all files of a certain file extension using an option in the menu bar. Open a file with the extension you want to set a default for and navigate through the following menus: View -> Syntax -> Open all with current extension as... ->[your syntax choice].

2012 年 6 月 28 日更新: Sublime Text 2 的最新版本(至少自 Build 2181 以来)允许通过单击右下角的当前语法类型来设置语法窗户.这将打开语法选择菜单,其中包含菜单顶部的 Open all with current extension as... 选项.

Updated 2012-06-28: Recent builds of Sublime Text 2 (at least since Build 2181) have allowed the syntax to be set by clicking the current syntax type in the lower right corner of the window. This will open the syntax selection menu with the option to Open all with current extension as... at the top of the menu.

2016-04-19 更新:截至目前,这也适用于 Sublime Text 3.

Updated 2016-04-19: As of now, this also works for Sublime Text 3.

这篇关于在 Sublime Text 2 中将默认语法设置为不同的文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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