Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 3: how to bind a shortcut to a specific file extension?

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?

like image 547
bdavidxyz Avatar asked Sep 17 '25 06:09

bdavidxyz


1 Answers

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).

like image 180
Xælias Avatar answered Sep 19 '25 16:09

Xælias