Reputation: 965
I'd like to switch to XML syntax in Sublime Text 2 using some key binding, for example Ctrl+Shift+X. There is a command for that, I can successfully execute it from console:
view.set_syntax_file("Packages/XML/XML.tmLanguage")
I tried this binding, but it doesn't work:
{ "keys": ["ctrl+shift+x"], "command": "set_syntax_file", "args" : {"syntax_file" : "Packages/XML/XML.tmLanguage" }}
Here API reference for the set_syntax_file command can be found. Any ideas?
Upvotes: 0
Views: 585
Reputation: 5572
Try this:
{ "keys": ["ctrl+shift+x"], "command": "set_file_type", "args" : {"syntax" : "Packages/XML/XML.tmLanguage" } }
Upvotes: 5
Reputation: 965
set_syntax_file is an API command, so to use it I created a simple plug-in.
Upvotes: 0