Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

sublimetext2 - 在Sublime Text 2中将默认语法设置为不同的文件类型(Set default syntax to different filetype in Sublime Text 2)

How do I set a default filetype for a certain file extension in Sublime Text 2?

(如何在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.

(具体来说,我希望* .cfg文件默认具有Ini语法高亮,但我似乎无法弄清楚如何创建此自定义设置。)

  ask by keiththomps translate from so

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

1 Answer

0 votes
by (71.8m points)

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.

(在Sublime Text 2(Build:2139)的当前版本中,您可以使用菜单栏中的选项设置特定文件扩展名的所有文件的语法。)

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] .

(打开一个文件,其中包含您要为其设置默认值的扩展名,然后浏览以下菜单: View -> Syntax -> Open all with current extension as... ->[your syntax choice] 。)

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.

(更新2012-06-28: Sublime Text 2的最新版本(至少自Build 2181开始)允许通过单击窗口右下角的当前语法类型来设置语法。)

This will open the syntax selection menu with the option to Open all with current extension as... at the top of the menu.

(这将打开语法选择菜单,并在菜单顶部选择Open all with current extension as...的选项。)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...