我正在尝试映射SublimeREPL插件命令的键盘快捷键。查看SublimeREPL看起来菜单项命令定义为:
Default.sublime-commands { "caption": "SublimeREPL: SBT for open folder", "命令": "run_existing_window_command", "参数": { "id": "repl_sbt", "file": "config/Scala/Main.sublime-menu" } }
或在
主菜单
{"command": "repl_open",
"caption": "SBT for opened folder",
"id": "repl_sbt",
"mnemonic": "b",
"args": {
"type": "subprocess",
"encoding": "utf8",
"external_id": "scala",
"cmd": {"linux": ["sbt"],
"osx": ["sbt"],
"windows": ["sbt"]},
"soft_quit": "nexitn",
"cwd": "$folder",
"cmd_postfix": "n",
"extend_env": {"osx": {"EMACS": "1", "PATH": "{PATH}:/usr/local/bin"},
"linux": {"EMACS": "1", "PATH": "{PATH}:/usr/local/bin"},
"windows": {"EMACS": "1"}},
"suppress_echo": false,
"syntax": "Packages/Scala/Scala.tmLanguage"
}
}
我尝试在我的SublimeREPL.sublime-settings中制作一个键绑定,以便:
[{ "keys": ["super+shift+k"], "command": "run_existing_window_command", "args":
{
"id": "repl_sbt",
"file": "config/Scala/Main.sublime-menu"
}
}]
但是当我尝试使用它时,Sublime控制台只是说:
选择器没有命令:noop:
如果我将其映射到:
[{ "keys": ["super+shift+k"], "command": "repl_open",
"args": {
"type": "subprocess",
"encoding": "utf8",
"external_id": "scala",
"cmd": {"linux": ["sbt"],
"osx": ["sbt"],
"windows": ["sbt"]},
"soft_quit": "nexitn",
"cwd": "$folder",
"cmd_postfix": "n",
"extend_env": {"osx": {"EMACS": "1", "PATH": "{PATH}:/usr/local/bin"},
"linux": {"EMACS": "1", "PATH": "{PATH}:/usr/local/bin"},
"windows": {"EMACS": "1"}},
"suppress_echo": false,
"syntax": "Packages/Scala/Scala.tmLanguage"
}
}]
您的第一个键绑定是正确的,应该按预期工作。位置位于首选项 ->键绑定 - 用户文件中。
[{ "keys": ["super+shift+k"], "command": "run_existing_window_command", "args":
{
"id": "repl_sbt",
"file": "config/Scala/Main.sublime-menu"
}
}]
根据您的描述,我怀疑其他命令正在劫持super+shift+k。
>>> sublime.log_commands(True)
会让你看到什么时候叫什么。