Sublime Forum

Default language for new blank documents

#1

When I launch Sublime Text, it opens up to a blank document with the language set to “Plain Text”.

Is there any way that I can get Sublime Text to automatically default this blank document to “Javascript”?

0 Likes

#2

You can override the ctrl + n keybinding (which always opens a new tab/new file with Plain Text syntax) to something that always has the JavaScript syntax set to it.

{
	"keys": ["ctrl+n"],
	"command": "new_file",
	"args": {
		"syntax": "Packages/JavaScript/JavaScript.sublime-syntax"
	},
},

Place this in your User keybindings. Now whenever you open a new file with ctrl + n, it should automatically have the JavaScript syntax applied to it.

2 Likes

#3

Thank you so much! :slight_smile:

I’m actually not a coder (yet), so I’m brand new to all of this! But I figured it out, thanks to your help! It works! :slight_smile:

0 Likes

#4

Glad you got it working.

0 Likes

#5

Do you have a method to set default language for blank documents opened via double-clicking on the tab area?

0 Likes

#6

ApplySyntax has an option that may work.

https://facelessuser.github.io/ApplySyntax/usage/#new-file-syntax

2 Likes

#7

Oh yes, this worked perfectly! It even changes the default syntax for Ctrl + N tabs! Thank you so much!

"new_file_syntax": "MarkdownEditing/Markdown"
1 Like