How to change the default syntax highlighting for new files in Sublime Text [duplicate]
Asked Answered
T

1

5

When I'm opening a new file (e.g. with Ctrl+N), the default Syntax in Sublime Text 3 is just Plain Text. I would like to change that into e.g. Markdown. (How) Is that possible?

I would like to avoid a "hacky" solution as proposed here:

creat a file in your Packages/User directory called 'default_syntax.py' or something, and add this:

import sublime, sublime_plugin

class DefaultSyntaxCommand(sublime_plugin.EventListener):
   def on_new(self, view):
      view.set_syntax_file('Packages/HTML/HTML.tmLanguage')
Thessalonians answered 24/10, 2016 at 16:0 Comment(0)
T
7

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": "Markdown/MultiMarkdown",

or

"new_file_syntax": "Markdown/Markdown",

depending on your installed Markdown syntax. Now if you open a new file, your default syntax will be Markdown.

Thessalonians answered 24/10, 2016 at 16:0 Comment(2)
Will this treat every file as Markdown regardless of content?Atone
This will treat every new file as MarkdownThessalonians

© 2022 - 2024 — McMap. All rights reserved.