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.
Supported Languages (Default)
- JavaScript / TypeScript
- Java
- C / C++
- C#
- Go
- Swift
- Kotlin
- PHP
- Rust
- Python
- Ruby
Installation
- Download the
.vsix file from Releases
- Open the Extensions view in VS Code
- 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:
- Find the languageId for Lua.
- Check the line and block comment syntax for the language.
- Add a setting under "stripPaste.commentPatterns" for the languageId.
Example for Lua:
"stripPaste.commentPatterns": {
// ...existing settings...
"lua": { "line": ["--"], "block": [["--[[", "]]"]] }
}
- Restart VS Code or save your settings to apply changes.
| |