get in touch
IntelliJ IDEA has a lot of features. While the goal of its sophisticated GUI is to meet all your software development needs, you may need some time and knowledge to find a window or a setting.
What if there is some kind of universal action that you could use to perform certain tasks faster? Take, for example, a simple but not so familiar command, Run Anything, available in IntelliJ IDEA 2018.3+.
Running this command is simple – press the Ctrl key twice. What is it for? This is a shortcut for multiple actions:
Run Anything is not just fast. It also allows you to string commands, define context, view suggestion lists, and preview help with some commands. It combines the simplicity of the command line with the flexibility and power of the IntelliJ IDEA GUI.
Let’s accept a new way of running anything!
Open recent projects
How do you usually open recent projects in IntelliJ IDEA?
You probably go to the main menu, click File | Open Recent and select your project from the list, which may take some time. Can you open it without taking your hands off the keyboard?
Faster way
With Run Anything, all you have to do is press Ctrl twice and start typing the project name. You will immediately see a list of suggestions. Click the name of the project you want to open. If you can’t remember the name, just type open to see a list of all recent projects.
Launch the run/debug configurations
In IntelliJ IDEA you can run and debug your application in several ways.
If you want to customize the launch of your application, you may have a variety of run/debug configurations. You must explicitly select a configuration from the list before launching the application, which may take some time.
Faster way
Run Anything can speed up this operation. Just like to open a project, press Ctrl twice and start typing the configuration name. To debug your application, hold down Shift while you press Enter.
Run Build Tools Command
Here Run Anything really shines in all its glory.
IntelliJ IDEA allows you to run project build commands, such as Maven goals or Gradle tasks, using tools such as Maven or Gradle. You can also specify tool commands in your startup configurations. This method works well but requires you to open tool windows or dialog boxes and use the mouse to navigate to the command you want.
Faster way
Press Ctrl twice and start typing a tool command, for example, mvn or gradle (it can also be npm or yarn or other tools depending on your IntelliJ IDEA project and plugins enabled). As you type, you will see a list of suggestions for completing the command.
Here’s another trick: with Run Anything you can easily define the execution context. Let’s say you want to run mvn validate on a specific Maven subproject – just click Project and select the Maven module.
Not sure when to use a Gradle task? Need quick help on what the Maven command does? Use Run Anything! It will display help with some external tool commands:
Run CLI commands
Finally, if what you enter is not a build tool command, configuration, or project name, Run Anything will run it as a terminal command.
By default, it will be executed in the root directory of your project, but what if you want to run a simple script that is open in the editor? Enter your command, then hold down Option (for macOS) or Alt (for Windows) while pressing Enter. This will “Run in Context”, i.e. execute your command in the directory where the open file is located.
Run Anything has been around for the last three years. During that time, JetBrains has collected your feedback and ideas on how to improve it. You can still send them. In the meantime, a brand new IntelliJ IDEA 2021.3 has been released which, if you haven’t already, you can try out right away by downloading from the JetBrains website.
Successful programming!