Sublime Forum

Find the command associated with a key

#1

Anyone know if there’s a way to look up what command will be executed for a given key combination in a given context? I’m pressing Option-Command-Return and getting strange white dots in the gutter; don’t know what they mean or how to find out what this key combo is doing. Thanks for any tips!

0 Likes

#2

type this in sublime’s console and all commands will be output there.

0 Likes

#3

That’s helpful, but in this specific case it looks like it’s running some kind of macro. If I hit Option-Command-Return while working in an HTML file, the output I see in the log is

no command for selector: breakUndoCoalescing command: move_to {"to": "hardeol"} command: move_to {"to": "hardbol"} command: expand_selection {"to": "word"} command: move {"by": "characters", "forward": true, "extend":true} command: move {"by": "wordends", "forward": true, "extend":true} command: move {"by": "words", "forward": false, "extend":true} command: move {"by": "characters", "forward": false, "extend":true} command: set_mark command: delete_to_mark command: yank command: move_to {"to": "hardeol"} command: left_delete command: insert {"characters": "\n"} command: run_macro_file {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"} command: yank command: expand_selection {"to": "word"}

Is there any way to tell what the “name” of this series of commands is, what it’s supposed to do?

0 Likes

#4

hard to tell.
do a search across keymap files for commands bound to alt+enter or super+enter

cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages && find . -name "*(OSX).sublime-keymap" -print0 | xargs -0 egrep "(super|alt)\+enter"

and check if you have something for those 3 keys. :confused:

0 Likes

#5

Okay, tried that and got

./Default/Default (OSX).sublime-keymap: { "keys": "super+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} }, ./Default/Default (OSX).sublime-keymap: { "keys": "alt+enter"], "command": "find_all", "args": {"close_panel": true}, ./Default/Default (OSX).sublime-keymap: { "keys": "alt+enter"], "command": "find_all", "args": {"close_panel": true}, ./Default/Default (OSX).sublime-keymap: { "keys": "ctrl+alt+enter"], "command": "replace_all", "args": {"close_panel": true}, ./Default/Default (OSX).sublime-keymap: { "keys": "alt+enter"], "command": "find_all", "args": {"close_panel": true},

I don’t see anything here bound to Option-Command-Enter or Alt-Command-Enter or Alt-Super-Enter, so I guess something else must be going on?

More generally, I’m moving to ST2 from TextMate; TM provides a way to either search for a command by name, or to type a key combination and see all commands bound to that. I thought maybe ST2 had a similar feature, but I guess not? Thanks a lot for your help in any case!

0 Likes

#6

That grep vitaLee specified won’t catch everything. Something like Default.sublime-keymap will also be used in building the key command list (just independent of the OS).

You may also try using theFindKeyConflicts plugin, which will list commands. It will display “conflicts” or “all keys” (in your case) in either a buffer or the quick panel, giving you some additional searching capability. My guess is what ever command is running is based in a file without an OS specific extension.

0 Likes

#7

ohhh, you are right skuroda.
@dang you can either try the FindKeyConflicts package or try dropping (OSX) from the grep

still not ideal as one would like but that’s what we have right now.

0 Likes

#8

Only know that because I found the FindKeyConflicts plugin wasn’t working as expected when I was testing it :smile: Also realized after posting here that I never got around to adding the Quick Panel option to all keys. So thanks :smiley:

0 Likes

#9

At one point i thought of suggesting the FindKeyConflicts package to dang,
but then i considered that maybe it won’t detect the binding he’s looking for, because conflicts might not exist.

0 Likes

#10

Understandable, there has always (okay maybe not always, but for a while) been a command to list all of the keymaps in a single buffer. I just now got around to adding the quick panel display list. FindKeyConflicts is a misleading name, but that’s what I was originally shooting for. Not really worth the trouble of changing now though. Well, let’s hope that the plugin or grep will help dang solve his problem!

0 Likes