4

我正在尝试为 SublimeREPL 插件命令映射键盘快捷键。查看 SublimeREPL 看起来菜单项命令定义为:

Default.sublime-commands { "caption": "SublimeREPL: SBT for open folder", "command": "run_existing_window_command", "args": { "id": "repl_sbt", "file": "config/Scala/Main .sublime-menu" } }

或在

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"
                    }

}]
4

1 回答 1

5

您的第一个键绑定是正确的,应该可以按预期工作。位置在Preferences -> Key Bindings - User file。

[{ "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)

会让你看到什么时候被调用。

于 2012-11-24T09:51:17.640 回答