Sublime Text 3:如何将快捷方式绑定到特定的文件扩展名? [英] 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.
例如,
跳转到匹配的括号"->在JS文件中有效->自定义绑定到 ctrl + m ,
"jump to matching bracket" -> works in JS files -> customly bound to ctrl+m,
转到匹配的标记对"(emmet)->在HTML文件中有效->我也想在这里 ctrl + m ,但不起作用(ST3理解跳转到匹配的括号",此处不适用).
"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?
推荐答案
显然,您可以尝试执行以下操作:
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"} ]
}
]
[
{ "keys": ["ctrl+x", "ctrl+i"],
"command": "insert_snippet",
"args": {"name": "Packages/User/mysnippet.sublime-snippet"},
"context": [ {"key": "selector", "operator": "equal", "operand": "text.tex.latex"} ]
}
]
在此处将前三行替换为所需的内容,并在text.tex.latex
替换为所需的范围(在您的情况下为source.js和text.html.basic).
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).
这篇关于Sublime Text 3:如何将快捷方式绑定到特定的文件扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!