Pregunta

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

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

}]
¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top