Sublime Text 2 - Default Document Type

后端 未结 3 1276
难免孤独
难免孤独 2020-12-16 02:36

Is there a way to set a default document type when saving a NEW FILE? I created several new files and I want to have a default value of .txt when saving a NEW FILE.

3条回答
  •  感动是毒
    2020-12-16 03:30

    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')
    

提交回复
热议问题