# Scratch files

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/ruby/llms.txt).

> **TL;DR**
> Create: `Ctrl+Alt+Shift+Insert` (Windows), `⌘ ⇧ N` (macOS), `⌃ ⇧ N` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ N` (macOS System Shortcuts), `Ctrl+Alt+Shift+Insert` (XWin), `Ctrl+Alt+Shift+Insert` (GNOME), `Ctrl+Alt+Shift+Insert` (KDE), `Ctrl+Alt+Shift+Insert` (Emacs), `Ctrl+Alt+Shift+Insert` (Sublime Text), `⌘ ⇧ N` (Sublime Text (macOS)), `Ctrl+Alt+Shift+Insert` (Visual Studio), `⌘ ⇧ N` (Visual Studio (macOS)), `Ctrl+Shift+N` (TextMate), `Ctrl+Alt+Shift+Insert` (NetBeans), `Ctrl+Alt+Shift+Insert` (Eclipse), `⌘ ⇧ N` (Eclipse (macOS))

Sometimes you may need to create temporary notes or draft up some code outside the project context. Instead of switching to a different application, you can use scratch files and scratch buffers.

> **Note:**
> Scratch files and buffers are not related to a specific project. They are available for any project that you open with the specific IDE instance.

* Scratch files are fully functional, runnable, and debuggable files that support syntax highlighting, code completion, and all other features for the corresponding file type. For example, while working on one project, you may come up with an idea for a method that you could later use in another project. You can create a scratch file with a draft of the method, which is not stored in your project directory but can be opened when you're working on any other project. You can use scratch files to draft code constructs, [HTTP requests](http-client-in-product-code-editor.html#creating-http-request-files), JSON documents, and so on.

* Scratch buffers are simple text files without any coding assistance features. Scratch buffers can be used for simple task lists and notes to yourself. They are also not stored in the project directory and can be opened from any other project. You can create up to five scratch buffers with default names, which are rotated and reused by clearing the content.

Procedure: Create a scratch file

1. Go to `File | New | Scratch File` or press `Ctrl+Alt+Shift+Insert` (Windows), `⌘ ⇧ N` (macOS), `⌃ ⇧ N` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ N` (macOS System Shortcuts), `Ctrl+Alt+Shift+Insert` (XWin), `Ctrl+Alt+Shift+Insert` (GNOME), `Ctrl+Alt+Shift+Insert` (KDE), `Ctrl+Alt+Shift+Insert` (Emacs), `Ctrl+Alt+Shift+Insert` (Sublime Text), `⌘ ⇧ N` (Sublime Text (macOS)), `Ctrl+Alt+Shift+Insert` (Visual Studio), `⌘ ⇧ N` (Visual Studio (macOS)), `Ctrl+Shift+N` (TextMate), `Ctrl+Alt+Shift+Insert` (NetBeans), `Ctrl+Alt+Shift+Insert` (Eclipse), `⌘ ⇧ N` (Eclipse (macOS)).

Alternatively, in the  Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Meta+1` (TextMate), `Ctrl+1` (NetBeans), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))), click ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.general.add.svg) on the toolbar and select `Scratch File`.

2. Select the  language of the scratch file.

Scratch files of the same type are automatically numbered and added to the Scratches and Consoles directory of the Project view.

Alternatively, you can create a new scratch file with the contents of the current selection in the editor. Select some text or code, press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Alt+Enter` (TextMate), `Alt+Enter` (NetBeans), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)) and then select Create new scratch file from selection. RubyMine will attempt to detect the language of the selected fragment and use the appropriate type and extension. If it can't detect the language of the selection, RubyMine will create the file with the same type and extension as the original file.

> **Tip:**
> RubyMine numbers scratch files sequentially starting from 1. If you close a tab with an empty scratch file, RubyMine deletes it.

Procedure: Create a scratch buffer

* There is no dedicated menu item for the action to create a new scratch buffer, but you can use the Find Action popup `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Meta+Shift+A` (TextMate), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)) and run the New Scratch Buffer action.

![The New Scratch Buffer action](https://resources.jetbrains.com/help/img/idea/2026.3/rm_new_scratch_buffer.png)

You can also add a shortcut for the New Scratch Buffer action as described in [Configure keyboard shortcuts](configuring-keyboard-and-mouse-shortcuts.html).

RubyMine creates a text file named `buffer1.txt`.

The next scratch buffer you create is named `buffer2.txt`, and so on up to `buffer5.txt`. When RubyMine reaches that limit, it will recreate `buffer1.txt` and suggest clearing the content for it. If you want to make sure RubyMine does not clear the scratch buffer after you have five, you can rename it.

Procedure: View all scratch files and buffers

* Open the Project view and expand `Scratches and Consoles | Scratches`.

![Scratches in the Project window](https://resources.jetbrains.com/help/img/idea/2026.3/rm_scratch_files_location.png)

> **Tip:**
> Query consoles are used to compose and execute SQL statements for databases defined in RubyMine as data sources. This functionality is available only when the Database Tools and SQL plugin is enabled. For more information, refer to [Query consoles](query-consoles.html).

* Use the [Find Action](null) popup `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Meta+Shift+A` (TextMate), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)) to invoke the  Show Scratch Files  action and view all available scratch files in a popup:

![The Scratch Files popup](https://resources.jetbrains.com/help/img/idea/2026.3/show-scratch-files-popup.png)

## Location of scratch files and buffers

By default, RubyMine stores scratch files and buffers in the [IDE configuration directory](directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#config-directory) under `scratches`. They are available from any IDE and project that uses this configuration directory.

Windows:

Syntax
: `%APPDATA%\JetBrains\<product><version>`

Example
: `C:\Users\JohnS\AppData\Roaming\JetBrains\RubyMine2026.3`

macOS:

Syntax
: `~/Library/Application Support/JetBrains/<product><version>`

Example
: `~/Library/Application Support/JetBrains/RubyMine2026.3`

Linux:

Syntax
: `~/.config/JetBrains/<product><version>`

Example
: `~/.config/JetBrains/RubyMine2026.3`

To change the location of the Scratches and Consoles directory, use the `idea.scratch.path` platform property. To change the location of just the Scratches directory, use the `idea.scratch.path/scratches` platform property. For more information, refer to [Advanced configuration](tuning-the-ide.html).

Procedure: Include a scratch file into your project

If a scratch file grows into something that you want to use in your project, move it into the desired directory of your project structure.

* Open a scratch file in the editor or select it under the `Scratches and Consoles | Scratches` directory in the Project view, press `F6` (Windows), `F6` (macOS), `F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ I` (macOS System Shortcuts), `F6` (XWin), `F6` (GNOME), `F6` (KDE), `F6` (Emacs), `F6` (Sublime Text), `F6` (Sublime Text (macOS)), `Ctrl+R, O` (Visual Studio), `⌘ R, O` (Visual Studio (macOS)), `F6` (TextMate), `Ctrl+M` (NetBeans), `Alt+Shift+V` (Eclipse), `⌘ ⌥ V` (Eclipse (macOS)), and select the target directory in your project.

* Drag a scratch file from the `Scratches and Consoles | Scratches` directory in the Project view to the target directory in your project.

* Select a scratch file in the `Scratches and Consoles | Scratches` directory in the Project view and press `Ctrl+X` (Windows), `⌘ X` (macOS), `⌘ X` (IntelliJ IDEA Classic (macOS)), `⌘ X` (macOS System Shortcuts), `Ctrl+X` (XWin), `Ctrl+X` (GNOME), `Ctrl+X` (KDE), `Shift+Delete` (Emacs), `Ctrl+X` (Sublime Text), `⌘ X` (Sublime Text (macOS)), `Ctrl+X` (Visual Studio), `⌘ X` (Visual Studio (macOS)), `Meta+X` (TextMate), `Ctrl+X` (NetBeans), `Ctrl+X` (Eclipse), `⌘ X` (Eclipse (macOS)), then select the target directory in your project and press `Ctrl+V` (Windows), `⌘ V` (macOS), `⌘ V` (IntelliJ IDEA Classic (macOS)), `⌘ V` (macOS System Shortcuts), `Ctrl+V` (XWin), `Ctrl+V` (GNOME), `Ctrl+V` (KDE), `Shift+Insert` (Emacs), `Ctrl+Shift+V` (Sublime Text), `⌘ ⇧ V` (Sublime Text (macOS)), `Ctrl+V` (Visual Studio), `⌘ V` (Visual Studio (macOS)), `Meta+V` (TextMate), `Ctrl+V` (NetBeans), `Ctrl+V` (Eclipse), `⌘ V` (Eclipse (macOS)).

Procedure: Change the language of a scratch file or buffer

1. In the [Project](project-tool-window.html)  tool window,

open the `Scratches and Consoles | Scratches`.

2. Right-click a scratch file or buffer and then click Change Language.

3. Select the desired language. You can start typing the name of the language to narrow down the list.

Procedure: View documentation for scratches

* Select any scratch file or buffer in the  Project tool window  and press `Ctrl+Q` (Windows), `F1` (macOS), `⌃ J` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Ctrl+Q` (XWin), `Ctrl+Q` (GNOME), `Ctrl+Q` (KDE), `Ctrl+Q` (Emacs), `Ctrl+Q` (Sublime Text), `Ctrl+Q` (Sublime Text (macOS)), `Ctrl+K, I` (Visual Studio), `⌘ K, I` (Visual Studio (macOS)), `Ctrl+Middle-Click` (TextMate), `Ctrl+Q` (NetBeans), `Alt+Middle-Click` (Eclipse), `⌥ Middle-Click` (Eclipse (macOS)) to view quick documentation with the location, type, size, creation, and modification date of the file.

