Home Download Buy Blog Forum Support

See what command is bound to a key

See what command is bound to a key

Postby p.f.moore on Thu Mar 14, 2013 5:18 pm

Is there a way that I can press a key combination, and see what command would be executed as a result? I know I can look in the key bindings file, but that's not quite what I'm after as the defaults can be overridden by user settings or plugins. There are a few cases where I've hit situations where I would have found this useful:

  • When I hit what I thought was the right key, but it wasn't. It did something, but I can't quite see what and I want to check (Hitting "undo" is often enough in this case, admittedly).
  • When a key doesn't work the way I thought it should (Ctrl-backtick isn't working for me, for instance) and I want to see what Sublime thinks is happening.
  • There is a binding I want to use for a custom action, and I want to check it's not already in use for something I'd forgotten about.

Thanks,
Paul
p.f.moore
 
Posts: 10
Joined: Thu Mar 14, 2013 5:10 pm

Re: See what command is bound to a key

Postby C0D312 on Thu Mar 14, 2013 5:32 pm

Just the forum for sublime.log_commands. There are instructions around here somewhere.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: See what command is bound to a key

Postby p.f.moore on Thu Mar 14, 2013 6:30 pm

C0D312 wrote:Just the forum for sublime.log_commands. There are instructions around here somewhere.


Thanks. That's what I was looking for. Oddly, one of my issues (Ctrl-` does not toggle the console on Windows 64-bit) seems to be something else. After experimenting a bit further, it looks like Ctrl+` (backquote) does nothing, but keys mapped to it are activated by Ctrl+' (single quote).

Strange. Could this be a bug? If so, I'm a little surprised if I'm the first one to have encountered it... :?
Paul
p.f.moore
 
Posts: 10
Joined: Thu Mar 14, 2013 5:10 pm

Re: See what command is bound to a key

Postby skuroda on Thu Mar 14, 2013 6:41 pm

sublime.log_commands(True) in the console is the best way to view what commands are being run. As a reminder, the console can be brought up through View -> SHow console if they keybinding isn't working (You can then see what is being run :)). In addition, I wrote the FindKeyConflicts plugin to help solve problems like this (granted I wasn't aware of sublime.log_commands before). The plugin would be particularly useful for the 3rd point. One of the commands list all keybindings.
skuroda
 
Posts: 685
Joined: Fri Oct 05, 2012 8:11 am


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], ninjaroll and 28 guests