Sublime Text 2默认文件键入新文件 [英] Sublime Text 2 Default File Type on new file
问题描述
我环顾四周,问题和答案似乎与我所寻找的不相符。任何时候我打开一个新文件它默认为一个计划文本文件。我主要使用HTML文件,所以我想知道是否有一个设置会改变,所以当我打开一个新文件时,它将默认为HTML?希望这是可能的。
I was looking around and the questions and answers did not seem to match what I am looking for. Anytime I open a new file it defaults to a plan text file. I mostly work with HTML files so I was wondering if there is a setting that would be changed so that when I open a new file it will default to HTML? Hope this is possible.
Rob
Rob
推荐答案
>新插件
然后粘贴到文件上,保存并将其命名为DefaultLanguage.py或其他内容
Then paste this over the file, hit save and call it "DefaultLanguage.py" or something
import sublime, sublime_plugin
class EverythingIsPowerShell(sublime_plugin.EventListener):
def on_new(self, view):
view.set_syntax_file('Packages/PowerShell/Support/PowershellSyntax.tmLanguage')
当然,您可以更改语言从PowerShell到...无论你喜欢什么。你只需要tmLanguage的相对路径。你可以通过以你喜欢的语言打开一个文件,然后打开控制台(View-> Show Console)并输入:
Of course, you can change the language from PowerShell to ... whatever you prefer. You just need the relative path to the tmLanguage. You can get that by opening a file in your favorite language and then open the console (View->Show Console) and type:
view.settings().get('syntax')
这篇关于Sublime Text 2默认文件键入新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!