Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>No-CopyNew to Visual Studio Code? Get it now.
No-Copy

No-Copy

Hasan Siddiqui

|
1 install
| (0) | Free
A lightweight VS Code extension that blocks cut, copy, and paste of code blocks in the editor, while leaving keys, single lines, and plain text untouched.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

No-Copy

A lightweight VS Code extension that blocks the cut, copy, and paste keyboard shortcuts in the editor only for code blocks, while letting you copy keys, single lines, and plain prose normally.

Features

When the selection (for cut/copy) or the clipboard contents (for paste) looks like a structured code block, the shortcut shows a warning instead of running. Anything else passes through to the normal clipboard action:

Shortcut (macOS / Win·Linux) Blocked Allowed
Cmd+C / Ctrl+C (Copy) multi-line code blocks keys, single lines, prose
Cmd+X / Ctrl+X (Cut) multi-line code blocks keys, single lines, prose
Cmd+V / Ctrl+V (Paste) pasting code blocks keys, single lines, prose

How a "code block" is detected

  1. Language — the file's language must be a code language (files detected as plaintext, markdown, log, etc. are never blocked).
  2. Structure — the text spans 2+ non-empty lines and shows code structure: code-like line endings ({ } ; :), bracket characters, or indentation nesting. Single lines and flat multi-line prose are treated as non-code.

Detection is a fast, synchronous heuristic using VS Code's built-in language detection — no external language-classification dependency. It is intentionally approximate; a multi-line comment inside a code file may occasionally be treated as a block.

The bindings apply only when the editor text area is focused (editorTextFocus), so shortcuts elsewhere in VS Code are unaffected.

Extension Settings

This extension contributes the following setting:

  • no-copy.enabled (boolean, default true) — Block cut/copy/paste of code blocks in the editor. Set to false to restore normal clipboard behavior without uninstalling the extension.

Known Limitations

  • Only keyboard shortcuts are intercepted. Copy/cut/paste via the editor's right-click context menu or the Edit menu still use the built-in commands and are not blocked — VS Code does not allow extensions to override those built-in menu actions.
  • Clipboard access from outside the editor (terminal, other apps) is unaffected.

Development

npm install        # install dependencies
npm run compile    # type-check, lint, and bundle to dist/
npm test           # run the test suite in a headless VS Code

Press F5 in VS Code to launch the extension in an Extension Development Host window for manual testing.

Release Notes

See CHANGELOG.md.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft