Home Download Buy Blog Forum Support

User Key Bindings not working

User Key Bindings not working

Postby mp1118 on Wed Jun 27, 2012 2:39 pm

Hello all,

I've been trying to get key bindings working to run an external program with a custom keybinding, but the keybindings never work.

The key binding command I'm using is:

Code: Select all
[
   { "keys": ["f9"], "cmd": ["C:\\ado\\personal\\rundo.exe", "$file_path//$file_name"] }
]


I can confirm that the code works as I also tried setting this up under the build menu, and that worked fine. It's just not as graceful of an implementation.

Thanks,
mp1118
mp1118
 
Posts: 1
Joined: Wed Jun 27, 2012 2:37 pm

Re: User Key Bindings not working

Postby quarnster on Wed Jun 27, 2012 3:34 pm

Run this in the python console:

Code: Select all
sublime.log_input(True)
sublime.log_commands(True)


This will show what keys ST2 receives (in case it doesn't receive f9) and what command is being run (in case some other command is already bound to f9).
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: User Key Bindings not working

Postby bizoo on Wed Jun 27, 2012 4:06 pm

mp1118 wrote:Hello all,

I've been trying to get key bindings working to run an external program with a custom keybinding, but the keybindings never work.

The key binding command I'm using is:

Code: Select all
[
   { "keys": ["f9"], "cmd": ["C:\\ado\\personal\\rundo.exe", "$file_path//$file_name"] }
]


I can confirm that the code works as I also tried setting this up under the build menu, and that worked fine. It's just not as graceful of an implementation.

Thanks,
mp1118

Keybindings run a ST2 "command" only, not a "cmd" which is actually a shell command.
You cannot mix build config with keybindings.

If you want to run a shell command, you can use the "build" command that trigger your build config:
Code: Select all
{ "keys": ["f7"], "command": "build" }

or directly use the "exec" command which is the command that is executed by build:
Code: Select all
{ "keys": ["ctrl+shift+y"], "command": "exec", "args": {"cmd": ["C:\\ado\\personal\\rundo.exe", "$file_path//$file_name"]} }

The problem is that it doesn't work as the $file_path and $file_name are not expanded (something missing IMHO)
So FWIK, if using build system doesn't work for you, you must write your own plugin that call the exec command without unexpanded variables.

Good luck!
bizoo
 
Posts: 873
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 18 guests