5

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?

Anthony Grist
  • 38,173
  • 8
  • 62
  • 76
ThinstallSoft
  • 145
  • 2
  • 11
  • 1
    Just save the file first with a proper extension and syntax coloring comes automatically? – Mikko Ohtamaa Nov 17 '12 at 13:13
  • 5
    Or use a shortcut: CTRL+SHIFT+P and type `HTML` and then Enter. Pretty quick. – Olle Sjögren Nov 19 '12 at 16:31
  • 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](https://sublime.wbond.net/search/PackageResourceViewer), or manually unzipping the sublime-package file. – aliteralmind Oct 01 '14 at 10:47
  • 1
    Possible duplicate of [Sublime Text 2 Default File Type on new file](http://stackoverflow.com/questions/11814506/sublime-text-2-default-file-type-on-new-file) – Kevin Brown-Silva Oct 09 '16 at 20:28

2 Answers2

-1

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.

navins
  • 3,429
  • 2
  • 28
  • 29
-1

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

Community
  • 1
  • 1
Ascanio
  • 69
  • 1
  • 6