Sublime Forum

Proper keybind to set syntax?

#1

SSD cratered and took my ST3 configs with it. i can’t remember how to keybind syntax changes. can someone help me out or point me to the oddly-unfindable spot in the docs? need to swap between PHP, JS, and HTML. and, NO, i’m not just going to use the command palette… :roll_eyes:

0 Likes

#2

If you don’t know how to get the command and arguments for a specific operation, you can enable command logging via sublime.log_commands(True) from the console and then do whatever you are interested in. I am pretty sure the cmd/args for switching to a specific syntax can be captured by that.

0 Likes

#3

@jfcherng didn’t know about the command log feature! cool! thank you. problem is, when i try to bind them, it does nothing. :frowning:

{
    "keys": ["ctrl+alt+h"],
    "command": "set_file_type {'syntax': 'Packages/HTML/HTML.sublime-syntax'}"
},
{
    "keys": ["ctrl+alt+j"],
    "command": "set_file_type {'syntax': 'Packages/JavaScript/JavaScript.sublime-syntax'}"
},
{
    "keys": ["ctrl+alt+p"],
    "command": "set_file_type {'syntax': 'Packages/PHP/PHP.sublime-syntax'}"
},

it saves without error, but the when activated, they do nothing. so something is off… :thinking:
also, the hotkeys, when successful, show up in the menus. these don’t. so we’re certainly missing something in the syntax of… the… syntax… command… :neutral_face:

0 Likes

#4

This is argument(s). So it should be

{
        "keys": ["XXXXXXX"],
        "command": "set_file_type",
        "args": {"syntax": "Packages/HTML/HTML.sublime-syntax"},
}
2 Likes

#5

:man_facepalming:… thank you.

0 Likes