Run IDE Features From the Terminal
IntelliJ IDEA integrates with many different tools used for software development. Most of these tools run in the system shell under the hood. Sometimes you don’t even realize that instead of running a command in the integrated terminal and reading console output, you can use the relevant IDE feature, like a tool window or a dialog that implements this functionality.
For example, the diff viewer actually runs the
diff command in the system shell to produce results. Another example is the Log tab in the Git tool window, which is based on the output of the
git log command.
If you didn’t know such features existed in IntelliJ IDEA or you are just used to running them in the terminal, now the IDE will let you know you can view the results in the GUI. This increases the discoverability of features and provides a handy way to open your favorite IntelliJ IDEA tools from the terminal.
Here is how it works:
- Type a supported command in the terminal and notice how it gets highlighted.
- Instead of pressing Enter, which runs the command in the terminal, press Ctrl + Enter or Cmd + Enter to open the corresponding GUI tool. In the example above, it will open the Log tab of the Git tool window and filter commits by authors with “dmitry” in their usernames.
In a similar manner, you can type the
diff command with the names of files you want to compare, and when it is highlighted, press Ctrl + Enter or Cmd + Enter to open the diff viewer instead of printing the diff output to the terminal.
This feature also works with most of the commands recognized by Run Anything (press Ctrl twice), such as
rails, and so on, depending on what plugins you have installed. Try out the commands that you use frequently and see if this feature helps you be more productive.
Try Ctrl + Shift + Enter or Cmd + Shift + Enter to run the highlighted commands in debug mode (use the Debug tool window instead of Run).
You can use the API provided to implement support for more commands and tools. For implementation examples, see the
TerminalShellCommandHandler classes in the source code of IntelliJ IDEA Community Edition.
If you want to disable this feature, click the gear icon in the Terminal tool window and clear the Run commands using IDE option.
If you want to change the default shortcuts, open the Settings / Preferences dialog, go to Keymap, then expand Plug-ins | Terminal and modify the following actions:
- Run highlighted command using IDE (default shortcut: Ctrl + Enter or Cmd + Enter)
- Debug highlighted command using IDE (default shortcut: Ctrl + Shift + Enter or Cmd + Shift + Enter)
You can try this feature in the latest IntelliJ IDEA 2020.2 EAP.
Subscribe to Blog updates
Thanks, we've got you!
IntelliJ IDEA 2023.3 EAP Is Open!
The IntelliJ IDEA 2023.3 Early Access Program kicks off today! Read this blog post to explore the new features you can test in the first EAP build.
Import Postman Collections to the HTTP Client
We know that many of you use Postman collections and want to stay in the flow while working with them. This means staying inside IntelliJ IDEA and not switching to a different app. Great news! You can now effortlessly transform Postman collections into .http and use them in the HTTP Client …
Java Annotated Monthly – September 2023
The September edition of Java Annotated Monthly is here! With this month’s release of Java 21 approaching, we're excited to bring you a final sneak peek into its crucial features. But that's not all! This edition is packed with helpful articles about cutting-edge AI technologies, including update…
IntelliJ IDEA 2023.2.1 Is Out!
We’ve just released the first bug-fix update for v2023.2. You can update to this version from inside the IDE, using the Toolbox App, or via snaps, if you’re using Ubuntu. You can also download it directly from our website. Here is the list of the most notable improvements and fixes inclu…