我正在尝试为SublimeREPL插件命令映射键盘快捷键。查看SublimeREPL,看起来菜单项命令定义为:
Default.sublime-commands { “caption”:“SublimeREPL:打开文件夹的SBT”, “command”:“run_existing_window_command”,“args”: { “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": "\nexit\n",
"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": "\nexit\n",
"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"
}
}]
答案 0 :(得分:5)
您的第一个键绑定是正确的,应该按预期工作。地点位于首选项 - >密钥绑定 - 用户文件。
[{ "keys": ["super+shift+k"], "command": "run_existing_window_command", "args":
{
"id": "repl_sbt",
"file": "config/Scala/Main.sublime-menu"
}
}]
根据你的描述,我怀疑其他一些命令是劫持超+ + + +。
>>> sublime.log_commands(True)
会让你看到什么时候被调用。