Actually there is an easy way to change language in Sublime Text 3, that's on the bottom right corner. But I need the fast way to change while my hands are on the keyboard. Is there any shortcut-key to change language in Sublime Text 3? Thank you.
All of the non-hidden syntaxes in Sublime are automatically added to the View > Syntax
main menu, which is the same menu that appears when you click on the file type in the bottom of the window. Additionally all syntaxes are added to the Command Palette as commands that start with Set Syntax:
.
So the easiest and fastest non-mouse way to swap the syntax on a file is to open the command palette an enter just enough filter text to find and select the command that will swap to your desired syntax, such as in the image below to switch to HTML.
Sublime remembers what command you select for any given command palette input, so for extra speed you can use filter text like sh
and manually select the Set Syntax: HTML
command that appears to tell Sublime that's the command you want. Now whenever you enter sh
it will automatically select that command for you by default.
The set_setting
command can be used to set any setting, including the syntax
setting, so you could also bind a key to that command to switch easily to an often used syntax. However that requires that you know the full package resource name of the syntax in question and it will not properly set up the syntax specific settings (that requires a plugin that uses view.assign_syntax()
).
There may be a package available on package control that provides such a command already, but I'm not aware of any offhand.