views:

333

answers:

2

I would like to enhance Eclipse so that when I press a custom key combo--say Ctrl + Shift + E--then it will run a command on the current file (if my current buffer is foo.c then it will run `mycommand foo.c' in foo.c's directory).

+1  A: 

Open the External Tools Configuration dialog from the Run menu. Create a new configuration with the following settings.

Location: c:\mycommand.exe (alter to your needs)

Working directory: ${container_loc}

Arguments: ${resource_loc}

Under Prefrences->General->Keys you can setup a shortcut for "Run last launched external tool".

This should solve your problem.

Stefan Teitge
A: 

That works well enough, Stefan, thanks.

One concern: if I want to have two different custom commands, I can't use them both. Furthermore, I have to remember which command I used last when I press the key combo, making the keyboard shortcut fairly useless in this case. Is there any way to do this that will let me assign a key combo to a specific action, or does Eclipse not let me do that?

Nathan