5
votes

In Sublime Text 2, when I double-click on the tab bar, it will create a new file, Sublime Text 2 will give it Plain Text syntax, How to change this default Plain Text syntax to HTML syntax?

I know there is a sublime-DefaultFileType that could set the default file type of new files which are created with the Ctrl+N. However, how can I make it take effect when I double-click on the tab bar to create a new file?

2
Just save the file first with a proper extension and syntax coloring comes automatically? - Mikko Ohtamaa
Or use a shortcut: CTRL+SHIFT+P and type HTML and then Enter. Pretty quick. - Olle Sjögren
DefaultFileType has a configuration setting called use_current_file_syntax which, if true, causes the currently-set syntax to be adopted by the new file, including if created with a double-click on the tab bar. Only caveat is that its current settings are only accessible via PackageResourceViewer, or manually unzipping the sublime-package file. - aliteralmind

2 Answers

-1
votes

I'm afraid there isn't a solution for double click.

According to the official website, DefaultFileType

This only affects files which are created with the Ctrl+N shortcut (Cmd+N on OSX).

for installation, follow the Installation part.

-1
votes

Please refer to this stack post: (On Text 3 it also works fine)

Sublime Text 2 Default File Type on new file

This py code solution support double click. DefaultFileType might be an easy option. But it didn't work in some cases, it has been 5 years old. In fact, I have to use this method for text 3 on windows.

This is the syntax for SQL :

http://rouge.jneen.net/pastes/PNq0

save it like DefaultLanguage.py

use the default location : \Data\Packages\User