Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Strip PasteNew to Visual Studio Code? Get it now.
Strip Paste

Strip Paste

makoto0428

|
3 installs
| (0) | Free
VS Code extension that strips leading characters and optionally removes trailing comments when pasting
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Strip Paste 📋

A Visual Studio Code extension for clean paste operations.

  • Removes the leading character from all non-empty lines if they start with the same symbol (e.g., +, >, -).
  • Optionally removes trailing comments (// ..., /* ... */, # ...).
  • Comment symbols inside string literals are not removed.
  • Safely removes consecutive trailing comments.
  • Supports # comments for Python and Ruby.
  • Comment symbols can be customized per language (//, /* ... */, #, etc.).
  • Empty lines are preserved.
  • Falls back to normal paste if conditions are not met.
  • Normal paste for multi-cursor mode.
Screenshot

Supported Languages (Default)

  • JavaScript / TypeScript
  • Java
  • C / C++
  • C#
  • Go
  • Swift
  • Kotlin
  • PHP
  • Rust
  • Python
  • Ruby

Installation

  1. Download the .vsix file from Releases
  2. Open the Extensions view in VS Code
  3. Select ... menu → Install from VSIX... and specify the file

Usage

  • Default keybinding: Ctrl+Shift+Alt+V (Cmd+Shift+Alt+V for macOS)
  • You can assign Strip Paste: Clean and Paste to any key via Command Palette or keybindings

Settings (Default Values)

Add to your settings.json:

{
  // Only remove if all non-empty lines start with one of these
  "stripPaste.leadingChars": ["+", ">", "-"],

  // Remove trailing comments (default: false)
  "stripPaste.removeTrailingComments": false,

  // Remove comment-only lines (default: false)
  "stripPaste.removeCommentOnlyLines": false,

  // Comment patterns per language (default)
  "stripPaste.commentPatterns": {
    "javascript": { "line": ["//"], "block": [["/*", "*/"]] },
    "typescript": { "line": ["//"], "block": [["/*", "*/"]] },
    "java": { "line": ["//"], "block": [["/*", "*/"]] },
    "c": { "line": ["//"], "block": [["/*", "*/"]] },
    "cpp": { "line": ["//"], "block": [["/*", "*/"]] },
    "csharp": { "line": ["//"], "block": [["/*", "*/"]] },
    "go": { "line": ["//"], "block": [["/*", "*/"]] },
    "swift": { "line": ["//"], "block": [["/*", "*/"]] },
    "kotlin": { "line": ["//"], "block": [["/*", "*/"]] },
    "php": { "line": ["//"], "block": [["/*", "*/"]] },
    "rust": { "line": ["//"], "block": [["/*", "*/"]] },
    "python": { "line": ["#"], "block": [] },
    "ruby": { "line": ["#"], "block": [] }
  }
}

How to Add a Supported Language

To add support for Lua:

  1. Find the languageId for Lua.
    • Open a file in the target language, then run "Developer: Show Current File Language Mode" from the Command Palette.
    • See the official documentation: https://code.visualstudio.com/docs/languages/identifiers
  2. Check the line and block comment syntax for the language.
  3. Add a setting under "stripPaste.commentPatterns" for the languageId. Example for Lua:
    "stripPaste.commentPatterns": {
      // ...existing settings...
      "lua": { "line": ["--"], "block": [["--[[", "]]"]] }
    }
    
  4. Restart VS Code or save your settings to apply changes.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft