bbenoist / vscode-shell

Execute shell commands from VS Code
27 stars 2 forks source link

Execute pre-configured commands #3

Open W4RH4WK opened 8 years ago

W4RH4WK commented 8 years ago

Is it possible to have certain commands configured/aliased in the user's config + binding a keyboard shortcut to it?

What I am thinking about is this, there are a couple of extensions around for "opening a (external) terminal", "open file in vim", "open file in browser", ... and I use some of them and would like to replace it with one, which can just run any command with a given shortcut.

If course some parameters would need to be passed like the current filename, working directory, line number, ...

Fred-Vatin commented 7 years ago

Key bindings to user configured commands would be awesome.

bbenoist commented 7 years ago

Thank you guys for the feedback!

Oh, and sorry @W4RH4WK for being late to reply 😕

Unfortunately, there is no programmatic way for extensions to dynamically register keybindings in vscode.

The only entry point for keybindings appears to be the package.json file which should not be modified by extensions.

A potential workaround would be to use the tasks.json file which is aimed at defining tasks at a project level. See "Binding keyboard shortcuts to tasks" for more info...

Hope this helps...

Fred-Vatin commented 7 years ago

We only need unique command name for each new user created command. Then one could use it to user keybindings.

s-oram commented 6 years ago

What I am thinking about is this, there are a couple of extensions around for "opening a (external) terminal", "open file in vim", "open file in browser", ... and I use some of them and would like to replace it with one, which can just run any command with a given shortcut.

Yes, this exactly.

Edit: Just found the "Open in Application" extension which handles the above use case. https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-open-in-application