我设置了一些自定义键绑定,但只有最后一个始终有效,之前的键绑定都无效。
[
{
// "keys": ["ctrl+b"], "command": "insert_snippet", "args": {"contents": "<b>${0:$SELECTION}</b>"}
"keys": ["ctrl+i"], "command": "insert_snippet", "args": {"contents": "<i>${0:$SELECTION}</i>"},
"keys": ["f11"], "command": "clone_file"
// "keys": ["ctrl+alt+t"], "command": "insert_snippet", "args": {"contents": "ṭ"}
// "keys": ["ctrl+alt+n"], "command": "insert_snippet", "args": {"contents": "ṇ"}
}
]
所以现在ctrl+i
不起作用,但如果我注释掉f11 clone file
,它就会起作用。每种情况都一样。
答案1
Sublime 的键绑定以 JSON 格式存储。JSON 对象用 和 声明{
,而 JSON 数组用和}
书写。键值对和对象用 分隔。[
]
,
因此,您每次都会为单个命令覆盖“键”和“命令”。您的键绑定必须如下所示:
[
{ "keys": ["ctrl+b"], "command": "insert_snippet", "args": {"contents": "<b>${0:$SELECTION}</b>"} },
{ "keys": ["ctrl+i"], "command": "insert_snippet", "args": {"contents": "<i>${0:$SELECTION}</i>"} },
{ "keys": ["f11"], "command": "clone_file" },
{ "keys": ["ctrl+alt+t"], "command": "insert_snippet", "args": {"contents": "ṭ"} },
{ "keys": ["ctrl+alt+n"], "command": "insert_snippet", "args": {"contents": "ṇ"} }
]