Files tool window
The Files tool window lets you manage files and directories that are attached to your project, and your query consoles.
Most of the functions in this tool window are accessed as context menu commands in the content pane and via associated shortcuts.
The view also contains the Scratches and Consoles folder that lets you manage created scratch files, query consoles, and extension scripts.
The following video gives a short overview of the Files tool window .
Views
The tool window has several views:
Files view. This view displays all the attached directories and files.
Open Files view. This view displays all the files that are currently open in the editor.
Changed Files view. This view displays the files that are under VCS and contain changes.
Scratches and Consoles view. This view lets you manage your scratch files and query consoles.
To switch between views, press Alt+Right/Alt+Left or select the desired view from the list on the header.
You can also display each view in a separate tab: click and disable the Group Tabs option.
Preview files
There are two ways to preview files without opening each one in a separate tab:
Use the file preview popup: select a file in the Files tool window and press Space.
Enable the preview tab: click and select .
Show file size and modification timestamp
You can view the size and modification timestamp for the files in the project tree.
In the Files tool window, click and select
.
Show tree indent guides
In the Files tool window , you can display vertical lines that mark indent levels and help you better understand the hierarchy of the components in your project.
Press Ctrl+Alt+S to open settings and then select
.Enable the Show indent guides option.
Tree indent guides are enabled
Tree indent guides are disabled
header context menu
The context menu that appears by right-clicking the header or clicking the Options button () provides settings for project views, viewing modes, as well as for switching between the views, resizing the tool window, and more.
The following table lists and briefly explains the available commands and options.
Item | Shortcut | Description |
---|---|---|
Select Next View or Tab | Alt+Right | Use this option to switch between different views. |
Select Previous View or Tab | Alt+Left | Use this option to switch between different views. |
Show List of Views or Tabs | Alt+Down | Use this option to switch between different views. |
Behavior | ||
Enable Preview Tab | Enable the preview tab that allows you to view files in a single tab one by one without opening each file in a new tab. | |
Open Files with Single Click | Open an item in the editor by clicking it in the Files tool window once. Otherwise, you need to double-click items to open them. Note that you cannot disable this option if you enable the preview tab. | |
Open Directories with Single Click | Expand and collapse directories in the Files tool window by clicking them once. Otherwise, you need to double-click a directory to open it or use the icon next to the directory's name. | |
Always Select Opened File | If this option is on, DataGrip automatically locates documents that you open in the editor in the current view of this window. | |
Appearance | ||
Excluded Files | This option is available only in the Project view. Turn this option on or off to show or hide excluded folders and files. | |
Scratches and Consoles | Hide or display the Scratches and Consoles node. This node contains your scratch files and query consoles. | |
Customize Tree Views | Navigate to options for tree views. to configure | |
Sort By | ||
Name | Sort files alphabetically by their names. The option does not affect the order of folders, they are always sorted alphabetically. | |
Type | Sort files by their extensions. The option does not affect the order of folders, they are always sorted alphabetically. | |
Modification Time (Newest First/Oldest First) | Sort files by the time they were modified. To display this information, select from the main menu.The option does not affect the order of folders, they are always sorted alphabetically. | |
Folders Always on Top | If the option is on, folders are shown above the files. Otherwise, all items are sorted alphabetically, and files and folders appear intermixed. | |
Speed Search | Ctrl+F | Search for an item. Learn more from Speed Search in tool windows |
Group Tabs | If this option is on, there is a list in the left-hand part of the header from which you can select the necessary view. If this option is off, the views are represented by tabs which appear in the left-hand part of the header. | |
View Mode | This option lets you control general appearance and behavior of the tool window. For full information, refer to Tool window view modes. | |
Move to | To associate the tool window with a different tool window bar, select this command, and then select the destination tool window bar (Top, Left, Bottom or Right). For full information, refer to the Move tool windows chapter. | |
Resize | To resize the tool window by moving one of its borders, select this command, and then select the necessary Stretch to option. Note that this command is not available for the floating mode. | |
Remove from Sidebar | This command hides the tool window, removes the button for showing and hiding the tool window, and removes the tool window from the quick access menu ( or ). To open the tool window again (and restore the associated features), use the main menu: or press Alt+2. | |
Hide | Shift+Escape | Hide the tool window. |
Help | This command opens the description of the Files tool window in the DataGrip online help. |
Title bar actions
You can right-click the window header and use the context menu to configure its viewing mode, associate the window with a different tool window bar, or resize and hide the window.
You can also use the toolbar buttons:
Item | Shortcut | Description |
---|---|---|
Automatically sets the focus on the file in the Files tool window when the editor area is in focus. The icon is not available if the Always Select Opened File option is currently on. | ||
Ctrl+NumPad + | Expand all nodes in the current view. | |
Ctrl+NumPad - | Collapse all expanded nodes in the current view. | |
The context menu that appears by right-clicking the header or clicking the Options button () provides settings for project views, viewing modes, as well as for switching between the views, resizing the tool window, and more. For more information about the settings, refer to the header context menu chapter. | ||
Shift+Escape | Hide the tool window . To hide all the tool windows, press Ctrl+Shift+F12. |
Content pane
The content pane shows the project directory and the attached directories. It also shows the Scratches and Consoles directory that lets you manage created scratch files, query consoles, and extension scripts.
Content pane context menu
The context menu of an item provides access to all the functions available for this item.
Item | Shortcut | Description |
---|---|---|
Attach Directory to Project | Use this command to associate a directory with the project. The selected directory along with all its contents becomes a part of your project. For more information about managing files and directories, refer to the User files topic. | |
New | Alt+Insert | Use this command or shortcut to create a new directory or file in the current directory. In the Scratches view, this command also lets you create a query console. |
Cut | Ctrl+X | Move the selected item or items from the current location to the clipboard. |
Copy | Ctrl+C | Copy the selected item or items to the clipboard. |
Copy Path/Reference | Use this command and one of the following options to copy the selected item(s) to the clipboard:
| |
Paste | Ctrl+V | Insert the contents of the clipboard into the selected location. |
Find Usages | Alt+F7 | Search for the usages of the selected item. (The Find Usages dialog will open.) |
Find in Files | Ctrl+Shift+F | Perform a text search. (Find in Files dialog will open.) |
Replace in Files | Ctrl+Shift+R | Perform text search-and-replace. (Replace in Path dialog will open.) |
Inspect Code | Use this command to run code inspections for the selected item. | |
Refactor | Perform one of the refactorings available for the selected item. For example, you can rename, move and copy files and directories. | |
Bookmarks | Add the selected item to an existing or new list of bookmarks. | |
Reformat Code | Ctrl+Alt+L | Reformat the source code in the selected file or in all files in the current directory. |
Delete | Delete | Physically delete the file or directory from disk. For more information about managing files and directories, refer to the User files topic. |
Detach Directory from Project | Remove the association of the directory with the project, and remove the directory from the attached directories list in Files tool window . The directory remains intact physically on disk. | |
Change Dialect (<CurrentDialect>) | For SQL files and database consoles, change the SQL dialect associated with the file or console. | |
Attach Data Source | For SQL files, attach a data source and ssession for . For more information about attaching data sources to SQL files, refer to Data source attachment. | |
Exclude from Project | Use this command to remove the association of the file or directory with the project. To return the item into the project, in the Files tool window , right-click it and select Include to Project. The directory remains intact physically on disk. For more information about managing files and directories, refer to the User files topic. | |
Run '<item_name>' | Ctrl+Shift+F10 | For an SQL file or query console: execute all the statements contained in the selected file or console. |
Reveal in Finder | Use this command to navigate to the selected file in Finder. | |
Open in Right Split | Shift+Enter | Split the editor into two parts and show the file in the right section. For more information, refer to Split screen. |
Open in | Open a file in your system file manager or in Terminal. | |
Local History | View local history for the selected file or directory, or create a label for the current version of your project. | |
Reload from Disk | Synchronize the view in the tool window with the view saved in the file system. If you change a file or directory contents externally, DataGrip, under certain circumstances, may not be aware of the corresponding changes unless you use this command. | |
Compare With | Ctrl+D | Compare the selected file or directory with another file or directory. See Diff Viewer for files and Diff Viewer for folders. |
Compare File with Editor | Compare the selected file with the file open on an active editor tab. See Diff Viewer for files. | |
External Tools | Launch a third-party tool. | |
Remove BOM | Remove the byte order mark (BOM) from the file. |
File colors
Files that belong to different scopes (production files or test files, for example) can be highlighted in different colors in the Files tool window , search results, and editor tabs.
To each scope, you can assign its own color. For more information, refer to Associate scopes with colors.