Scratch Files: The Case for a Throwaway Plain-Text Buffer
Quick answer
A scratch file — sometimes called a scratch buffer — is a temporary, usually unnamed plain-text or code file for jotting something down before you know whether it's worth keeping. Open it, type, close it. No filename to pick, no folder to choose, and usually no save prompt. It's the opposite of a project file: disposable by design, not permanent by default. Developers reach for one to test a regex, paste command output, or draft a note without cluttering a real project. Below: how scratch files actually work, when they're the right tool, and when you should skip the shortcut and just save a real file.
How it actually works
Most editors that support scratch files split the idea into two flavors. A scratch file keeps the language-aware features of a real file — syntax highlighting, code completion, and in some IDEs even the ability to run or debug it. A scratch buffer is plainer: a simple text file without any coding assistance, meant for notes, a task list, or anything that doesn't need a language attached to it. Both do the same job — a place to draft or paste something in isolation, without it becoming part of a project. That's the same instinct behind a plain-text note-taking system built for fast capture: capture first, decide what it's worth later.
"Temporary" means different things depending on the tool. In IntelliJ IDEA, scratch files persist across restarts but get deleted automatically if you close one while it's still empty. Scratch buffers cycle through five default names — buffer1.txt through buffer5.txt — and older ones get overwritten once you hit that limit, unless you rename one to keep it around (JetBrains documentation). Vim goes further in the other direction. A scratch buffer created with :enew | setlocal buftype=nofile bufhidden=wipe noswapfile exists purely in memory — no file on disk, no swap file, no recovery if you close the window by accident. Same concept, very different guarantees about what survives.
When to use a scratch file (and when to skip one)
A scratch file earns its keep when the content is genuinely disposable: testing a regex or a small function before it belongs anywhere real, pasting command output or a log you want to search through, jotting a task list or a draft commit message for right now, or editing config files and dotfiles quickly before the final value goes into the real dotfile. In each case, the point isn't to keep the file — it's to think in text without deciding on a filename first.
Skip the shortcut when you'll reference the content again, need to share it, or want version history for it. That belongs in a real, named file from the start. Here's the honest tradeoff: a scratch file is fast precisely because it skips naming and saving, but that same lack of structure means nothing stops you from losing real work if you treat it as more than a scratch pad. If you'd be upset to lose it, it was never a scratch file to begin with.
How Carets fits in
Carets is a fast, native notes and code editor for iPhone, iPad, and Mac, and the scratch-file habit is basically what it's built for. Opening a new plain-text or code file takes seconds, with syntax highlighting already there for the language you're working in. Nothing forces you to commit to a project structure before you know if an idea is worth keeping. Files, projects, and tags exist for the moment a scratch note does graduate — instead of losing it when you close the app, you tag or file it once it's proven useful, and it's still there for searching across your plain-text notes later.
That durability comes from the format, not the app. Plain text — including Markdown — is readable and publishable as-is, without proprietary markup locking it to one editor. That's exactly why a quick scratch note and a permanent reference file can live in the same place without friction. Carets works for writers and developers alike, natively on iOS and Mac, not as a web wrapper. If your scratch notes, code snippets, and config edits are scattered across five different apps, Carets is available on iPhone, iPad, and Mac.
Frequently Asked Questions
What's the difference between a scratch file and a scratch buffer?
A scratch file usually keeps a language's IDE features — syntax highlighting, sometimes even running or debugging — so you can draft a real snippet of Java, Python, or JSON with full support. A scratch buffer is plain text with no coding assistance, meant purely for notes, pasted output, or a quick task list. Both share the same core trait: neither is meant to become a permanent project file without a deliberate save.
Will I lose a scratch file if I close the app?
Depends on the tool. Some editors keep scratch files on disk in a config folder so they survive a restart, but auto-delete them if you close them empty. Others, like a Vim scratch buffer, exist purely in memory and vanish the moment you close the window, with no recovery. Treat anything in a scratch file as temporary by default, and copy out anything worth keeping.
When should I turn a scratch file into a real file?
As soon as it stops being disposable. If you're going to reference a snippet again, share it with someone, or check it into version control, save it as a named file in the right place. A scratch file is for the stretch of time before you know whether something is worth keeping — not for storing anything you'd be upset to lose.
Are scratch files only useful for code?
No. They're just as useful for prose: a quick note before a meeting, a paragraph you're not sure belongs in a document yet, or a draft of an email. The common thread is speed — no filename, no folder decision, no save dialog — which is exactly what makes plain text a good fit for them.
Conclusion
A scratch file is a deliberate no-commitment space: fast in, fast out, disposable unless you promote it. The same plain-text habits that make a good scratch file also make a good permanent note — quick to open, readable without an app-specific format, easy to search later. The format matters more than which app you're using in the moment.