Trim IndentVS Code extension that removes common leading whitespace from the selected text, preserving relative indentation. VS Code has built-in commands to indent and outdent lines, but no command to trim the common leading whitespace from a selection. This has been an open request since 2018. Trim Indent fills that gap. 🚀 Usage
Trim IndentReplaces the selection in-place with the trimmed text. Before
After
Behavior
Trim Indent and CopyApplies the same trimming logic as Trim Indent but copies the result to the clipboard instead of replacing the selection. The editor is left unchanged. Useful for pasting dedented code into documentation, chat, or another file. 📦 InstallationVS Code / CursorInstall from the VS Code Marketplace, or run:
Or search for "Trim Indent" in the Extensions sidebar. Open VSXAvailable on Open VSX Registry. Custom KeybindingBy default, the commands are available through the Command Palette. To bind Trim Indent and Copy to a keyboard shortcut:
This overrides the default copy shortcut with a trim-and-copy when text is selected. The regular 🛠️ Development
Press 📄 LicenseThis project is licensed under the MIT License — see the LICENSE file for details. |