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

十年热恋 提交于 2019-12-09 22:17:06

问题


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



来源:https://stackoverflow.com/questions/25268340/sublime-text-3-how-to-bind-a-shortcut-to-a-specific-file-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!