{"id":245950,"date":"2022-05-30T12:57:38","date_gmt":"2022-05-30T11:57:38","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=datagrip&#038;p=245950"},"modified":"2022-08-09T16:45:31","modified_gmt":"2022-08-09T15:45:31","slug":"top-10-datagrip-shortcuts-to-empower-your-coding","status":"publish","type":"datagrip","link":"https:\/\/blog.jetbrains.com\/en\/datagrip\/2022\/05\/30\/top-10-datagrip-shortcuts-to-empower-your-coding","title":{"rendered":"Top 10 DataGrip shortcuts to empower your coding"},"content":{"rendered":"\n<p>We love shortcuts. They make coding faster and more efficient. But they are not always easy to remember. With that in mind, we\u2019ve put together a list of our top-10 most useful DataGrip shortcuts.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Execute statement: <em>Cmd\/Ctrl+Enter<\/em><\/h3>\n\n\n\n<p>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 <em>Cmd\/Ctrl+Enter<\/em>.<\/p>\n\n\n\n<p>DataGrip executes the whole statement or only the selection if you\u2019ve 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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/image-63.png\"  width=\"800\" alt=\"\" class=\"wp-image-251206\"\/><\/figure>\n\n\n\n<p>By the way, you can customize query execution settings by clicking the <em>\u0421ustomize<\/em> link. Set up a query suggestion list, choose how to view query results, choose how to show errors, and much more.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/Query-execution-preferences-1.gif\" width=\"800\" alt=\"\" class=\"wp-image-250888\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Show intention actions: <em>Opt+Enter\/Alt+Enter<\/em>&nbsp;<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/inention-gif.gif\" alt=\"\" class=\"wp-image-250899\" width=\"800\"\/><\/figure>\n\n\n\n<p>Use <em>Opt+Enter\/Alt+Enter<\/em> to open the list of suggestions and select an action from the list.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Search Everywhere: Double-press <em>Shift<\/em><\/h3>\n\n\n\n<p>Double-press <em>Shift<\/em> to open the search window, and just start typing! You can use abbreviations and synonyms in your search.<\/p>\n\n\n\n<p>For instance, \u2018<em>fa<\/em>\u2018 is enough to find \u2018<em>film_actor<\/em>\u2018. And searching for <em>\u2018caret\u2019<\/em> will also bring up items with <em>\u2018cursor\u2019<\/em> in their name.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/image-64.png\"  width=\"800\" alt=\"\" class=\"wp-image-251218\"\/><\/figure>\n\n\n\n<p>You can open the search window with the needed scope right from the start:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/Shortcuts-Actions.png\"  width=\"800\" alt=\"\" class=\"wp-image-248164\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-black-color has-text-color\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Tab<br><\/th><th class=\"has-text-align-left\" data-align=\"left\">Searches for<br><\/th><th class=\"has-text-align-left\" data-align=\"left\">Shortcut <br><\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">Database       <\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>major objects<\/strong> by name<\/td><td class=\"has-text-align-left\" data-align=\"left\"><em>Cmd+O (Ctrl+N)<\/em><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Files<\/td><td class=\"has-text-align-left\" data-align=\"left\">any <strong>file or directory<\/strong> by name<\/td><td class=\"has-text-align-left\" data-align=\"left\"><em>Cmd+Shift+O <\/em><br><em>(<em>Ctrl+Shift+N<\/em><\/em>)<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Symbols<\/td><td class=\"has-text-align-left\" data-align=\"left\">a <strong>symbol<\/strong>. The search scope will include <br>columns, indexes, and other objects<\/td><td class=\"has-text-align-left\" data-align=\"left\"><em>Cmd<\/em>+<em>Opt<em>+O<\/em> <\/em><br><em>(<em>Ctrl+Alt+Shift+N<\/em>)<\/em><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Actions<\/td><td class=\"has-text-align-left\" data-align=\"left\">an <strong>action<\/strong> by name<\/td><td class=\"has-text-align-left\" data-align=\"left\"><em>Cmd+Shift+<em>A<\/em> <\/em><br><em>(<em>Ctrl<\/em>+Shift+A)<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Recent files: <em>Cmd\/Ctrl+E<\/em>&nbsp;<\/h3>\n\n\n\n<p>For those moments when you accidentally close the tab you need: <em>Cmd\/Ctrl+E<\/em> brings up your history in DataGrip. Probably the best shortcut for peace of mind.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/image-66.png\" alt=\"\" class=\"wp-image-251249\" width=\"800\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/CtrlE.gif\" alt=\"\" class=\"wp-image-250910\" width=\"800\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Open new console: <em>Cmd+Shift+L\/Ctrl+Shift+Q<\/em><\/h3>\n\n\n\n<p>This one is pretty self-explanatory. The <em>Cmd+Shift+L\/Ctrl+Shift+Q<\/em> combination opens a new console way faster than you can do via the toolbar.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/image-65.png\"  width=\"800\" alt=\"\" class=\"wp-image-251230\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Reformat code: <em>Cmd+Opt+L\/Ctrl+Alt+L<\/em><\/h3>\n\n\n\n<p>In the editor, select a code fragment you want to reformat and press <em>Cmd+Opt+L\/Ctrl+Alt+L<\/em>. DataGrip can reformat selected blocks of source code, all code in the current file, or changes uncommitted to VCS. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/CmdOptL-1.gif\"  width=\"800\" alt=\"\" class=\"wp-image-250921\"\/><\/figure>\n\n\n\n<p id=\"b5db8e40\">Customize your SQL code style in <em>Preferences | Editor | Code Style | SQL<\/em>. You can apply formatting rules for alignment, wrapping, indentation, and much more.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/Code-style-preferences.mp4\" width=\"800\"><\/video><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Hide\/Restore all tool windows: <em>Cmd\/Ctrl+Shift+F12<\/em>&nbsp;<\/h3>\n\n\n\n<p><em><em>Cmd\/Ctrl+Shift+F12 <\/em><\/em>hides all tool windows and maximizes the editor tab to ensure that nothing will distract you from coding<em>.<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/HideRestore.gif\" alt=\"\" class=\"wp-image-250932\" width=\"800\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Paste from History: <em>Cmd\/Ctrl+Shift+V<\/em><\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>Use <em>Cmd\/Ctrl+Shift+V<\/em> to bring up the \u0441lipboard history and then choose what you want to paste from it. To clear the history, click <em>Clear<\/em> in the dialog.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/copypaste-gif.gif\" alt=\"\" class=\"wp-image-250943\" width=\"800\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Refactor | Rename: <em>Shift+F6<\/em>&nbsp;<\/h3>\n\n\n\n<p>Place the caret on the object you want to rename and press <em>Shift+F6<\/em> to invoke the <em>Rename<\/em> dialog for a directory, file, table, or column.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/Renamerefactor.gif\"  width=\"800\" alt=\"\" class=\"wp-image-250965\"\/><\/figure>\n\n\n\n<p>If you\u2019re editing an alias or argument in the function, just start typing a new name inline or press <em>Shift+F6<\/em> twice to open the <em>Rename<\/em> 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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/rename-inline.gif\"  width=\"800\" alt=\"\" class=\"wp-image-250988\"\/><\/figure>\n\n\n\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=U5SOD-eeK50&amp;t=888s\" target=\"_blank\" rel=\"noopener\">Check out this video<\/a> to learn more about renaming different objects, reviewing changes, and inspecting them in the source code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Generate code: <em>Cmd+N<\/em>\/<em>Alt+Insert<\/em><\/h3>\n\n\n\n<p>Press <em>Cmd+N<\/em>\/<em>Alt+Insert<\/em> in the editor to generate and modify DDL statements. You can create a function, procedure, schema, trigger, etc. with the <em>Generate<\/em> action. A DDL snippet will be pasted into the editor.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/Generate-gif.gif\"  width=\"800\" alt=\"\" class=\"wp-image-250999\"\/><\/figure>\n\n\n\n<p>That\u2019s all! We hope we have inspired you to use shortcuts more often. You can find the DataGrip keymap <a href=\"https:\/\/resources.jetbrains.com\/storage\/products\/datagrip\/docs\/DataGrip_keymap.pdf\" target=\"_blank\" rel=\"noopener\">here<\/a> to save time when coding.<\/p>\n\n\n\n<p>Questions?<\/p>\n\n\n\n<ul><li>Let us know in the comments<\/li><li><a href=\"https:\/\/www.jetbrains.com\/support\/\" target=\"_blank\" rel=\"noopener\">Contact our support<\/a><\/li><li><a href=\"https:\/\/twitter.com\/datagrip\" target=\"_blank\" rel=\"noopener\">Tweet us!<\/a><\/li><li>Email us at datagrip@jetbrains.com<\/li><li>Report bugs to our <a href=\"https:\/\/youtrack.jetbrains.com\/issues\/DBE\" target=\"_blank\" rel=\"noopener\">issue tracker<\/a><\/li><\/ul>\n\n\n\n<p>The DataGrip team<\/p>\n","protected":false},"author":1294,"featured_media":251190,"comment_status":"closed","ping_status":"closed","template":"","categories":[89,2347],"tags":[91],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/datagrip\/245950"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/datagrip"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/types\/datagrip"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/users\/1294"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/comments?post=245950"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/datagrip\/245950\/revisions"}],"predecessor-version":[{"id":251247,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/datagrip\/245950\/revisions\/251247"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/media\/251190"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/media?parent=245950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/categories?post=245950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/tags?post=245950"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/cross-post-tag?post=245950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}