Sublime Text 3: how to bind a shortcut to a specif

2020-07-22 09:45发布

问题:

I would like to customize shortcut, but apply them only to a specific extension.

For example,

"jump to matching bracket" -> works in JS files -> customly bound to ctrl+m,

"go to matching tag pair" (emmet) -> works in HTML files -> I would like to ctrl+m also here, but doesn't work (ST3 understand "jump to matching bracket" which doesn't apply here).

I was wondering if specializing a shortcut to a specific extension would do the trick?

回答1:

Apparently you can try something like this:

[ { "keys": ["ctrl+x", "ctrl+i"], "command": "insert_snippet", "args": {"name": "Packages/User/mysnippet.sublime-snippet"}, "context": [ {"key": "selector", "operator": "equal", "operand": "text.tex.latex"} ] } ]

Where you'ld replace the first 3 lines by what you want, and text.tex.latex by the scope you want (source.js and text.html.basic in your case).