Sublime Text 2 Default File Type on new file

后端 未结 3 928
旧时难觅i
旧时难觅i 2021-01-02 14:55

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

3条回答
  •  没有蜡笔的小新
    2021-01-02 15:46

    Create a new plugin Tools > Developer > New Plugin...

    Paste this in:

    import sublime, sublime_plugin
    
    class EverythingIsPowerShell(sublime_plugin.EventListener):
       def on_new(self, view):
          view.set_syntax_file('Packages/PowerShell/Support/PowershellSyntax.tmLanguage')
    

    Save and call it NewTabSyntax.py. New tabs will now default to Powershell.

    You can change the syntax to whatever you prefer. To find out the "path" of a particular syntax, simply open a file of that syntax, open the console (View > Show Console) and type:

    view.settings().get('syntax')
    

提交回复
热议问题