key map sublimeREPL commands in Sublime Text 2

I'm trying to map keyboard shortcuts for SublimeREPL plugin commands. Looking at SublimeREPL it looks like a menu item command is defined as:

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

or in

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

I've tried making a keybinding in my SublimeREPL.sublime-settings to:

[{ "keys": ["super+shift+k"], "command": "run_existing_window_command", "args":
        {
            "id": "repl_sbt",
            "file": "config/Scala/Main.sublime-menu"
        }
}]

But when I try to use it the Sublime console just says:

no command for selector: noop:

Same if I map it to:

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

}]

Your first keybinding is correct and should work as expected. Place is in Preferences -> Key Bindings - User file.

[{ "keys": ["super+shift+k"], "command": "run_existing_window_command", "args":
        {
            "id": "repl_sbt",
            "file": "config/Scala/Main.sublime-menu"
        }
}]

based on your description, I suspect that some other command is hijacking super+shift+k.

>>> sublime.log_commands(True)

will let you see what's get called when.

链接地址: http://www.djcxy.com/p/90904.html

上一篇: 为特定项目设置构建系统

下一篇: Sublime REPL命令在Sublime Text 2中使用