← Back to Blog

Developers & Code | Published Aug 21, 2026 | Updated Oct 13, 2026 | 6 min read

Where to Store Code Snippets (Not Clipboard History)

By Deepender Yadav

Where to Store Code Snippets (Not Clipboard History) — Edge Drop Guide

Store code you reuse somewhere built for reuse: editor snippets (VS Code snippets or JetBrains live templates) for code you type into files, a text expander such as Espanso for text you type in any app, and scripts or docs in the repository for anything longer or shared with the team. Clipboard history is the wrong home for a snippet library. It has no placeholders or variables, it's organised by when you copied something rather than what it is, and Windows clipboard history keeps only 25 items, clearing unpinned ones at restart. Use it for what you copied in the last few hours.

Where each kind of snippet belongs

What you reuseBest homeWhy
Boilerplate you type in the editor: a test skeleton, a component, a logging lineVS Code snippets or JetBrains live templatesTab stops, placeholders and variables; triggered by a short prefix
Snippets the whole team should useProject snippets committed to the repoEveryone gets the same version, and changes go through review
Text you type in any app: sign-offs, ticket templates, a shell commandA text expander such as EspansoWorks in every app, not just the editor
Commands you run oftenScripts in the repo, package.json scripts, PowerShell profile functionsRunnable, versioned and documented in one place
Longer code you share onceA gist or a docs pageA link instead of a wall of pasted text
Something you copied ten minutes agoClipboard historyBuilt for exactly this

VS Code snippets

  1. Open File > Preferences > Configure Snippets (or run Snippets: Configure Snippets from the Command Palette).
  2. Choose a language for language-specific snippets, or New Global Snippets file for snippets that work everywhere.
  3. Add an entry. Each snippet has a prefix you type, a body and an optional description:
{
  "Log a variable": {
    "prefix": "logv",
    "body": ["console.log('${1:name}:', $1);$0"],
    "description": "Log a variable with its name"
  }
}

Type logv, accept the suggestion, and the cursor lands on name. Whatever you type there fills both places marked $1, and Tab moves on to $0, the final cursor position.

Snippets can also pull in variables such as $CURRENT_YEAR, $TM_FILENAME and $CLIPBOARD. A body like "try {\n\t$CLIPBOARD\n} catch (err) {\n\t$0\n}" wraps whatever you last copied, so the clipboard and the snippet work together instead of competing.

To share snippets with your team, choose the project option in the same menu. VS Code stores them in a .code-snippets file inside the project's .vscode folder, and a scope property can limit each snippet to certain languages. Commit the file and everyone who opens the project gets them.

JetBrains live templates

IntelliJ IDEA, PyCharm, WebStorm and the other JetBrains IDEs call snippets live templates. Type a template's abbreviation and press Tab to expand it. Manage them in Settings (Ctrl+Alt+S) > Editor > Live Templates, where you can enable, edit and group them. Surround templates, which wrap the current selection, are under Ctrl+Alt+J. JetBrains IDE history vs a system clipboard manager covers JetBrains' built-in paste history.

Espanso, for text you type everywhere

Editor snippets only work in the editor. For text you also type in a browser, a terminal or a chat app, a text expander replaces a short trigger with the full text wherever you type it. Espanso is free, open source (GPL-3.0) and runs on Windows, macOS and Linux. On Windows its configuration lives in %APPDATA%\espanso; run espanso edit to open the main match/base.yml file:

matches:
  - trigger: ":br"
    replace: "Best regards,\nSam"

  - trigger: ":today"
    replace: "{{mydate}}"
    vars:
      - name: mydate
        type: date
        params:
          format: "%Y-%m-%d"

  - trigger: ":mdlink"
    replace: "[$|$]({{clipb}})"
    vars:
      - name: clipb
        type: clipboard

:today inserts the current date. :mdlink builds a Markdown link around the URL on your clipboard and leaves the cursor inside the brackets, where $|$ sits. Each {{name}} in replace needs a matching variable definition, like the vars entries here; a date format or an undeclared {{clipboard}} typed straight into replace won't expand. Do you need a text expander instead of a clipboard manager? helps decide whether you need one.

Scripts and docs in the repository

Anything longer than a few lines, or anything you run rather than type, belongs in the project:

  • Commands: add them to package.json scripts, a Makefile, or a scripts/ folder, so npm run reset-db replaces a pasted five-line command.
  • Personal shell helpers: define functions in your PowerShell profile (the file at $PROFILE) or your ~/.bashrc.
  • Reference code for others: a README section, a docs page or a gist. A gist created with gh gist create is secret by default, which means unlisted, not private; anyone with the link can read it. Gists or clipboard for sharing throwaway code compares the options.

What clipboard history is still good for

Clipboard history earns its place for short-lived working material: the error message you copied before switching windows, the three values you're moving between a ticket and a form, the path you'll paste twice more today, the two versions of a function you want to diff side by side. Win+V keeps the last 25 items and clears unpinned ones at restart; VS Code and clipboard history explains how to use it in the editor.

A clipboard manager keeps more, and pins let a few items stay put. Edge Drop, for example, never evicts pinned items, but it has no abbreviations, placeholders or text expansion, so it complements snippets rather than replacing them. Clipboard manager vs text expander vs notes app sets out which tool covers which job, and Edge Drop vs Espanso compares the two approaches directly.

Keep secrets out of all of these. A snippet file, an Espanso match or a pinned clip holding an API key is a credential stored in plain sight; use a password manager or secret store instead.

FAQ

Can VS Code snippets use the clipboard?

Yes. The $CLIPBOARD variable inserts the current clipboard text into the snippet body when the snippet expands.

Should snippets go in the repository?

Project-specific ones should: a .code-snippets file in .vscode is shared with everyone who opens the project. Keep personal snippets in your user snippets.

Is a clipboard manager a snippet manager?

Not really. A clipboard manager records what you copy; a snippet manager stores text you deliberately save, with names, triggers and placeholders. Pinning a few items in a clipboard manager works for a handful of snippets, not a library.

Related reading

Sources

Deepender Yadav
Written by Deepender Yadav · Creator & Developer

Deepender Yadav created Edge Drop and builds and tests it, from the edge-hover shelf to each release. A B.Tech Computer Science Engineering student, Deepender writes the Edge Drop guides, comparisons and developer posts, and checks product details against the app's source code.

GitHub · LinkedIn

Copy. Stack. Drop.

Transform your clipboard into an interactive edge shelf. Stack, pin, and drag assets into any app with zero friction.

Download for Windows Get from Microsoft Store

How to Install Guide · First 10 Minutes Guide · Drag & Drop Guide · Edge Drop vs Win+V · Support

Free · Lightweight · Privacy First
Find us on CodeHype