Sublime Text 2 Default File Type on new file

后端 未结 3 914
旧时难觅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:35

    pls install Package sublime-DefaultFileType https://github.com/spadgos/sublime-DefaultFileType

    which will automatically sets the syntax for new files.

    0 讨论(0)
  • 2021-01-02 15:44

    It is possible with the ApplySyntax Plugin. Once it is installed (e.g. via PackageControl), you can set the ApplySyntax User Settings like that:

    "new_file_syntax": "HTML",
    

    Now if you open a new file, your default syntax will be HTML. Of course you can set every Syntax you have installed.

    0 讨论(0)
  • 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')
    
    0 讨论(0)
提交回复
热议问题