Top 10 DataGrip shortcuts to empower your coding
We love shortcuts. They make coding faster and more efficient. But they are not always easy to remember. With that in mind, we’ve put together a list of our top-10 most useful DataGrip shortcuts.
Execute statement: Cmd/Ctrl+Enter
Click the statement or select the fragment of code that you want to execute. It can be a subquery or a group of statements. Press Cmd/Ctrl+Enter.
DataGrip executes the whole statement or only the selection if you’ve highlighted a fragment of code. If there are several statements, a list of suggestions appears and you can choose which one to execute. It always contains the option to run all the statements. Statements that you are going to execute are highlighted in a query editor.
By the way, you can customize query execution settings by clicking the Сustomize link. Set up a query suggestion list, choose how to view query results, choose how to show errors, and much more.
Show intention actions: Opt+Enter/Alt+Enter
You might have seen a yellow bulb icon in the editor. This means that DataGrip has detected elements of your code that can be improved and is ready to make suggestions. We call it intention actions. They cover a wide range of situations from warnings to optimization suggestions. By clicking a yellow bulb icon, you can view intention actions available in the current context.
Use Opt+Enter/Alt+Enter to open the list of suggestions and select an action from the list.
Search Everywhere: Double-press Shift
Double-press Shift to open the search window, and just start typing! You can use abbreviations and synonyms in your search.
For instance, ‘fa‘ is enough to find ‘film_actor‘. And searching for ‘caret’ will also bring up items with ‘cursor’ in their name.
You can open the search window with the needed scope right from the start:
|Tab||Searches for||Shortcut |
|Database||major objects by name||Cmd+O (Ctrl+N)|
|Files||any file or directory by name||Cmd+Shift+O |
|Symbols||a symbol. The search scope will include |
columns, indexes, and other objects
|Actions||an action by name||Cmd+Shift+A |
Recent files: Cmd/Ctrl+E
For those moments when you accidentally close the tab you need: Cmd/Ctrl+E brings up your history in DataGrip. Probably the best shortcut for peace of mind.
Open new console: Cmd+Shift+L/Ctrl+Shift+Q
This one is pretty self-explanatory. The Cmd+Shift+L/Ctrl+Shift+Q combination opens a new console way faster than you can do via the toolbar.
Reformat code: Cmd+Opt+L/Ctrl+Alt+L
In the editor, select a code fragment you want to reformat and press Cmd+Opt+L/Ctrl+Alt+L. DataGrip can reformat selected blocks of source code, all code in the current file, or changes uncommitted to VCS.
Customize your SQL code style in Preferences | Editor | Code Style | SQL. You can apply formatting rules for alignment, wrapping, indentation, and much more.
Hide/Restore all tool windows: Cmd/Ctrl+Shift+F12
Cmd/Ctrl+Shift+F12 hides all tool windows and maximizes the editor tab to ensure that nothing will distract you from coding.
Paste from History: Cmd/Ctrl+Shift+V
DataGrip keeps a record of the items you copy to the clipboard from the moment when you launch the IDE up until you close it.
Use Cmd/Ctrl+Shift+V to bring up the сlipboard history and then choose what you want to paste from it. To clear the history, click Clear in the dialog.
Refactor | Rename: Shift+F6
Place the caret on the object you want to rename and press Shift+F6 to invoke the Rename dialog for a directory, file, table, or column.
If you’re editing an alias or argument in the function, just start typing a new name inline or press Shift+F6 twice to open the Rename dialog. When you rename the element inline, you can click icons near the element and select whether you want to rename it in comments and strings or in all text occurrences.
Check out this video to learn more about renaming different objects, reviewing changes, and inspecting them in the source code.
Generate code: Cmd+N/Alt+Insert
Press Cmd+N/Alt+Insert in the editor to generate and modify DDL statements. You can create a function, procedure, schema, trigger, etc. with the Generate action. A DDL snippet will be pasted into the editor.
That’s all! We hope we have inspired you to use shortcuts more often. You can find the DataGrip keymap here to save time when coding.
- Let us know in the comments
- Contact our support
- Tweet us!
- Email us at email@example.com
- Report bugs to our issue tracker
The DataGrip team