DataGrip 2021.1 Help

Navigation

You can quickly navigate through code in the editor using different actions and popups.

You can start with watching a video tutorial to check what navigation options are available in DataGrip.

Navigate with the caret

  • To navigate backwards, press Ctrl+Alt+Left. To navigate forward, press Ctrl+Alt+Right.

  • To navigate to the last edited location, press Ctrl+Shift+Backspace.

  • To find the current caret location in the editor, press Up and Down arrow keys.

  • To highlight a word at the caret you are trying to locate, select Edit | Find | Next Occurrence of the Word at Caret from the main menu.

  • To see on what element the caret is currently positioned, press Alt+Q.

  • To move caret between matching code block braces, press Ctrl+Shift+M.

Move the caret

You can use different actions to move the caret through code. You can also configure where the caret should stop when moved by words and on line breaks.

  • To move the caret to the next word or the previous word, press Ctrl+Right or Ctrl+Left.

    By default, DataGrip moves the caret to the end of the current word.

    When you move the caret to the previous word, the caret is placed in the beginning of the current word. You can configure the position of the caret when you use these actions.

    In the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | General. In the Caret Movement section, use the When moving by words and Upon line break options to configure the caret's behavior.

  • To move the caret forward to the next paragraph or backward to the previous one, press Ctrl+Shift+A and search for the Move Caret Forward a Paragraph or Move Caret Backward a Paragraph action.

    You can also select a text and then move the caret forward or backward to a paragraph. Press Ctrl+Shift+A and search for the Move Caret Forward a Paragraph with Selection or Move Caret Backward a Paragraph with Selection action.

    If you need, you can assign shortcuts to these actions. Refer to Keyboard shortcuts for details.

Find recent locations

You can also check your recently viewed or changed code using the Recent Locations popup.

  • To open the Recent Locations popup, press Ctrl+Shift+E. The list starts with the latest visited location at the top and contains code snippets.

  • While in the popup, use the same shortcut or select the Show changed only checkbox to see only the locations with changed code.

  • To search for a code snippet, in the Recent Locations popup, start typing your search query. You can search by the code text, filename, or breadcrumbs.

  • To delete a location entry from the search results, press either Delete or Backspace.

    Keep in mind that the deleted location is also removed from the list of entries that you access with the Ctrl+Alt+Left shortcut.

Recent Locations popup

Use bookmarks for navigation

  • To create an anonymous bookmark, place the caret at the needed code line and press F11.

  • To create a bookmark with mnemonics, place the caret at the needed code line, press Ctrl+F11 and select a number or a letter for the mnemonics.

  • To open the Bookmarks dialog, press Shift+F11. You can use this dialog to manage bookmarks, for example, delete, sort bookmarks, or supply them with a brief description.

  • To navigate to an existing bookmark with letter mnemonics, press Shift+F11 and then press a letter you need. DataGrip returns you to the editor and to the corresponding bookmark.

  • To navigate to an existing bookmark with number mnemonics, press Ctrl and the bookmark's number.

  • Every created bookmark is reflected in the Favorites(View | Tool Windows | Favourites) tool window which you can also use for navigation to your bookmarks.

    Bookmarks and the Favorites window

You can navigate to the initial declaration of a symbol and symbol's type from its usage.

You can automatically locate a file in the Files tool window.

  1. If the file is opened in the editor, press Alt+F1 to open the Select In popup.

  2. In the popup, select Files View and press Enter. DataGrip locates your target in the Files tool window.

Select in popup

Locate a file in the Project tool window

You can use the Open Files with Single Click (previously called Autoscroll to Source) and Always Select Opened Files (previously called Autoscroll from Source) actions to locate your file in the Files tool window.

  1. In the Files tool window, right-click the Files toolbar and from the context menu select Always Select Opened File. After that DataGrip will track the file that is currently opened in the active editor tab and locate it in the Files tool window automatically.

  2. You can also select the Open Files with Single Click option. In this case, when you click a file in the Project view, DataGrip will automatically open it in the editor.

Context menu
  • To jump to the next or previous found issue in your code, press F2 or Shift+F2 respectively. Alternatively, from the main menu, select Navigate | Next / Previous Highlighted Error.

    DataGrip places the caret immediately before the code issue.

  • Configure the way DataGrip navigates between code issues: it can either jump between all code issues or skip minor issues and only navigate between detected errors. Right-click the code analysis marker in the scroll bar area and choose one of the available navigation modes from the context menu:

    • To have DataGrip skip warnings, infos, and other minor issues, choose Go to high priority problems only.

    • To have DataGrip jump between all detected code issues, choose Go to next problem.

Locate a code element with the Structure view popup

You can use the structure view popup to locate a code element in the file you are working on.

  1. To open the structure view popup, press Ctrl+F12.

  2. In the popup, locate an item you need. You can start typing a name of the element for DataGrip to narrow down the search. Press Enter to return to the editor and the corresponding element.

    While in the popup, you can sort file members, see anonymous classes and inherited members.

    Structure View popup

Use the Lens mode

The lens mode lets you preview your code without actually scrolling to it. The mode is available in the editor by default when you hover your mouse over the scrollbar. It is especially useful when you hover over a warning or an error message.

  • To disable the lens mode, right-click the code analysis marker located on the right side of the editor and in the context menu clear the Show code lens on the scrollbar hover checkbox.

  • As an alternative, in the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | General | Appearance and clear the Show code lens on the scrollbar hover checkbox.

Use breadcrumbs for navigation

You can navigate through the source code with breadcrumbs that show names of views, aliases, fields, tables, and other objects in the currently opened file. By default, breadcrumbs are enabled and displayed at the bottom of the editor.

  • To change the location of breadcrumbs, right-click a breadcrumb, in the context menu select Breadcrumbs and the location preference.

  • To edit the breadcrumbs settings, in the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | General | Breadcrumbs.

Editor breadcrumbs

Find a line or a column

  1. In the editor, press Ctrl+G.

  2. In the Go to Line/Column dialog, specify a line or column number, or both, separating them with : and click OK.

    Go to line/column dialog

  3. If you don't want to see the line numbers in the editor, in the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | General | Appearance and clear the Show line numbers checkbox.

Find a file path

  1. In the editor, press Ctrl+Alt+F12 or in the context menu, select Open in | Finder.

  2. In the Reveal in Finder popup, select a file or a directory to open in a path finder and press Enter.

Find recent files

You can search for the recent and recently edited files with the Recent Files popup.

  • To open the Recent Files popup with the list of recent files, press Ctrl+E.

  • To see only the recently edited files, press Ctrl+E again or select the Show changed only checkbox.

  • To search for items in the popup, use the Speed Search functionality. Just start typing a search query, and the Search for field appears. DataGrip displays the results based on your search query, the list shrinks as you type.

Recent Locations popup

Go from a reference to a definition

  • To go to the definition of a column, table or any other object, select the object name in your code and navigate to Navigate | Declaration Ctrl+B. Alternatively, press Ctrl and click a reference.

    Go from a reference to a definition

Go from a reference to its DDL definition

  1. In the Setting/Preferences dialog Ctrl+Alt+S, navigate to Database | General.

  2. In the Navigation pane, clear the Prefer database view over DDL editor checkbox.

Open a definition in the DDL editor

Edit the DDL definition of a database object

  1. In the Database tool window (View | Tool Windows | Database), click a database object.

  2. Click the Source Editor button (the Source Editor button) on the toolbar. Alternatively, press Ctrl+B.

Edit the DDL definition of a database object

Open a DDL definition of an object from the database tree view

You can open a DDL definition of an object (double-click the object) from the database tree view by default.

  1. In the Setting/Preferences dialog Ctrl+Alt+S, navigate to Database | General.

  2. In the Navigation pane, clear the Prefer data editor over DDL editor checkbox.

Open a DDL definition of an object in the database tree view

Switch between different definition views

  1. Place a caret over the object and press Alt+F1.

  2. Select the desired view from the context menu.

Switch between different definition views

Switch between files using the switcher

With the switcher, you can switch between open files, consoles, and tool windows.

To open the Switcher window, press Ctrl+Tab. Do not release the Ctrl key. Use arrow keys to move in the Switcher window. When you release the Ctrl key, the selected item becomes active, and the switcher closes.

the Switcher
    Last modified: 19 May 2021