I want to make a new key binding to change syntax to, let's say, HTML or CSS. I searched the official and unofficial documentation to see if there are any answers to my problem.
5 Answers
Use the following key combination to pull up the command palette:
Ctrl+Shift+P
then type:
sshtml
(for example, to set the syntax to HTML)

- 866
- 11
- 20

- 12,492
- 6
- 40
- 53
-
That will have to do. Thanks! – Alex Sep 01 '12 at 12:55
-
5Very quick way to check out multiple syntaxes by just typing ss and select from that list (hint: you can use arrow keys to select the next/previous) – WOUNDEDStevenJones Sep 03 '13 at 19:23
-
9For the record, on OS X, it's `⌘ + Shift + p` to pull up the command palette. – Andi Aug 11 '15 at 13:48
-
this doesn't actually answer the question at all. the response below by @dzhi does. use that. and pay attention to the comment about JavaScript for ST3. – WhiteRau Aug 07 '20 at 19:48
This is how i roll, if that's what you meant exaclty:
// Syntax Change
{"keys": ["alt+shift+h"], "command": "set_file_type",
"args": {"syntax": "Packages/HTML/HTML.tmLanguage"}
},
{"keys": ["alt+shift+m"], "command": "set_file_type",
"args": {"syntax": "Packages/Markdown/Markdown.tmLanguage"}
},
{"keys": ["alt+shift+p"], "command": "set_file_type",
"args": {"syntax": "Packages/PHP/PHP.tmLanguage"}
},
{"keys": ["alt+shift+j"], "command": "set_file_type",
"args": {"syntax": "Packages/Javascript/JSON.tmLanguage"}
},
-
2~/Library/Application Support/Packages/User/Default (OSX).sublime-keymap – jasonleonhard Dec 30 '14 at 23:30
-
1To find other .tmLanguage files, I went to Sublime's Preferences > Browse Packages. – Tatiana Tyu Mar 25 '15 at 13:39
-
As of Sublime Text 3 build 3126 this is also working with the exception that javascript is under the path /Packages/JavaScript/ (capital S for Script) – Wladek Surala May 09 '17 at 10:24
There is an easy way to do that.
On the right bottom, there is a button, click on that button you will get all the available syntax.

- 132
- 1
- 11
You can use the Command Pallet (ctrl + shift + p) to change the Syntax, but sometimes using "ss" or "sshtml" brings up other commands that are un-related to the "Set Syntax" options.
You can also add a new Key Binding User Preference that brings up the Command Pallet with the text "Set Syntax: " already in it. Then you just have to type the language you want to set it to.
To setup this key-binding shortcut:
- Open the Command Pallet (ctrl + shift + p)
- Find and select the "Preferences: Key Bindings" option
- Update your User ".sublime-keymap" file to have the "keys" json-object listed in the array:
[
"// additonal/exsiting key comands go here...",
{ "keys": ["ctrl+alt+l"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Set Syntax: "} }
]
Now you can use ctrl+alt+l to bring up the command prompt. Then just type HTML, CSS, or whatever language you're looking to switch too.
Feel free to change the "keys" combination from ctrl+alt+l to anything else you want the shortcut to be too.

- 26
- 3
dzhi's answer doesnt work anymore for JSON in Sublime 4.
The correct path is
Packages/JSON/JSON.tmLanguage

- 359
- 2
- 7