Sublime Forum

Custom mapping Menu > Item > Item > Item to an F key

#1

I generally know how to map keys in Key Bindings - User, but I’m not quite sure the syntax for long nested menu commands.

I’d like to map a function key like F19 (Mac) to View > Syntax > Babel > Javascript (Babel)

What would be the syntax for this?

0 Likes

#2

Use sublime.log_commands(True) to log commands/arguments in the ST console (ctrl+`).

1 Like

#3

I ran that command, but I’m still not sure what json style code to include in my Keybindings — User file.

e.g. I added this to make a comment out of a selection:

{ "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": false } }

0 Likes

#4
command: set_file_type {"syntax": "Packages/php-grammar/PHP.sublime-syntax"}

{
    "keys": ["WHATEVER"], 
    "command": "set_file_type", 
    "args": { "syntax": "Packages/php-grammar/PHP.sublime-syntax" } 
}
1 Like

#5

Thank you @jfcherng, that worked.

0 Likes

#6

Thank you!

0 Likes