开发者

In IntelliJ IDEA, how can I create a key binding that executes a shell script with the current file as a parameter?

开发者 https://www.devze.com 2023-04-09 15:54 出处:网络
In IntelliJ IDEA, how can I create a key binding that executes a shell script with the current file as a parameter?

In IntelliJ IDEA, how can I create a key binding that executes a shell script with the current file as a parameter?

For exanmple, if I am in a test file (entity.spec.js), I want to save and hit a key binding to trigger a shell script with that file as the parameter:

./开发者_StackOverflowrun_test.sh /full/path/to/entity.spec.js

Any idea how to do that?


You can do it using the External Tools. Then you can assign a keyboard shortcut to your tool in Settings | Keymap.

Please note that you should specify your shell interpreter as a Program for the external tool (such as /bin/bash) and pass your script path and the file name as Parameters. Use Insert Macro button to add a macro for the current editor file path.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号