Clipboard File PastePaste clipboard content into your workspace, save it beside the active document, and insert a language-specific reference at the cursor. Features
Quick start
Markdown exampleDefault settings:
Result:
HTML exampleDefault settings:
Result:
How it works
The save directory comes from the active document. Relative After insert, the extension tries to select the generated alt or link text so you can edit it immediately. ConfigurationSettings namespace: Manifest entries (
|
| Field | Purpose |
|---|---|
dirname |
Relative save directory (supports date and RID placeholders) |
filename |
File name pattern (supports date and RID placeholders) |
altText |
Default alt or link text inserted into the template |
template |
Reference inserted at the cursor |
Notes:
templateuses[dirname],[filename], and[altText]- Markdown templates may also use the literal
![altText]token for image syntax - Templates are matched by
languageIdsuch asmarkdownorhtml - Unsupported languages fall back to the
markdowntemplate dirnamemust not contain..
clipboardFilePaste.defaultTextExtension
Extension used when pasting plain text from the clipboard. Default: txt.
Placeholders
| Placeholder | Description | Example |
|---|---|---|
[YYYY-MM-DD] |
Date format via dayjs | 2026-07-13 |
[YYYY-MM-DD-HH-mm-ss] |
Date-time format | 2026-07-13-22-15-30 |
[RID-N] |
Random 0-9A-Za-z string, length N |
[RID-4] |
[dirname] |
Resolved save directory in template |
. |
[filename] |
Resolved file name in template |
2026-07-13.png |
[altText] |
Resolved alt or link text in template |
description |
Rules:
- Date and RID placeholders must be wrapped in
[] - Identical placeholders in one paste resolve to the same value
- If the resolved filename has no extension, the clipboard file extension is appended
- Relative paths are resolved from the current file directory
- Absolute paths and
file://URLs are supported
Clipboard sources
| Source | Behavior |
|---|---|
| Empty clipboard text | Treated as a clipboard image; uses a platform shell script |
| File path in clipboard | Copies an existing file and preserves its extension |
| HTTP(S) URL | Downloads the response with timeout and size limits; uses URL path or Content-Type for the extension |
| Image data URL or raw SVG | Saves with the derived image extension |
| Plain text | Saves as UTF-8 using defaultTextExtension; leading and trailing whitespace are preserved |
Filename collisions
If ./2026-07-13.png already exists, the extension tries:
./2026-07-13-1.png./2026-07-13-2.png- ...
The attempt stops after 100 candidates.
Platform notes
- Windows uses PowerShell to read clipboard images and saves them as PNG
- macOS supports PNG, JPEG, and GIF clipboard images through AppleScript
- Linux requires
xclipand tries PNG, JPEG, GIF, and WebP clipboard targets - File operations use
vscode.workspace.fs, including the final save after clipboard image capture - Clipboard shell scripts only write to a temp file; the extension copies that data into the workspace through
workspace.fs
Known limitations
- Windows clipboard images are normalized to PNG
- Linux clipboard image support depends on
xclipand the image formats exposed by the desktop environment - Untitled files require an open workspace so the save location can be resolved
- Non-image binary clipboard content is not supported outside file-path text
- HTTP downloads are limited to 30 seconds and 50 MB
Source layout
| Path | Responsibility |
|---|---|
src/extension.ts |
Command registration and activation |
src/core/paste.ts |
Main paste workflow and clipboard routing |
src/core/utils.ts |
Path, placeholder, and clipboard text parsing helpers |
src/core/collision.ts |
-1, -2, ... filename collision handling |
src/core/templateConfig.ts |
Settings validation for language templates |
src/core/altTextSelection.ts |
Post-insert alt/link text selection |
src/core/workspaceFs.ts |
vscode.workspace.fs wrappers |
src/core/httpDownload.ts |
HTTP(S) download with size and timeout limits |
src/core/constant.ts |
Shared command and settings identifiers |
res/ |
Platform shell scripts for reading clipboard images |
Development
pnpm --filter vscode-clipboard-file-paste install
pnpm --filter vscode-clipboard-file-paste compile
pnpm --filter vscode-clipboard-file-paste test
pnpm --filter vscode-clipboard-file-paste package
compilebundlessrc/extension.tstodist/extension.jstestruns Vitest unit tests under__tests__/packagebuilds the extension and produces a.vsixfile
Press F5 in this package folder to launch an Extension Development Host. The launch configuration runs compile first.
When changing commands, keybindings, menus, or settings, edit contributes in package.json directly.