Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Chameleon TextNew to Visual Studio Code? Get it now.
Chameleon Text

Chameleon Text

Juanma Santoyo

|
1 install
| (1) | Free
Robust tool for massive line-by-line text manipulation and transformation
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Chameleon Text

Chameleon Text Logo

VS Code Marketplace Open VSX Registry

Chameleon Text is a robust and fast extension for VSCode designed for developers and data analysts who need powerful line-by-line text manipulation and mass transformation.

[!TIP] This extension is optimized for use with Chameleon Selection, which significantly enhances your ability to select lines for transformation.

VS Code Marketplace Open VSX Registry

Features

  • Contextual Execution: Operates exclusively on selected lines, or the entire document if no selection is made. Multiple cursors are fully supported.
  • Direct Execution: Commands are accessible via the VSCode Command Palette, customizable keyboard shortcuts, and the right-click context menu.
  • Real-Time Preview: Instantly see the results and highlighted lines in the editor as you type command arguments, adapting seamlessly to your current VSCode color theme.
  • Interactive Contextual Help: QuickPick selectors for predefined arguments and an integrated Help button (?) inside input boxes provide instant context and examples without leaving the editor.

Scripting System

Tired of repeating the same sequence of commands? Chameleon Text features a built-in scripting engine to execute multiple commands in a chain.

How to use scripts

  1. Create a Script: You can create .chameleon files or use an Untitled tab and set the Language Mode to Chameleon.
    • Tip: Use the Chameleon: New Script command to quickly create an Untitled script file!
  2. Syntax: Write one command per line in the format: CommandName "argument1" "argument2".
    • Use double quotes " for arguments. You can escape internal quotes with a backslash \".
    • Add comments to your scripts by starting a line with #.
  3. Run a Script: Use the Chameleon: Run Script command.
    • If you are in a text document, it will prompt you to select an open script or a .chameleon file in your workspace to apply to the text.
    • If you are currently in a script file, it will prompt you to select an open text file to apply the script to.

Script Example:

# Remove empty lines and duplicates
RemoveEmptyLines
Distinct

# Convert to title case
ToTitle

# Prepend a bullet point and add numbering
Prepend "- "
Enumerate "$i. "

# Replace using Regex (e.g. swap word order: 'Last, First' -> 'First Last')
Replace "/(\\w+),\\s*(\\w+)/g" "$2 $1"

Command Reference

The extension exposes the following commands in the VSCode Command Palette. When used in a script, use the Script Name and provide the necessary Arguments.

Filtering & Structure

Command Palette Script Name Arguments Description
Chameleon: Distinct Distinct None Removes duplicate lines, keeping only the first occurrence.
Chameleon: Remove Empty Lines RemoveEmptyLines None Removes completely empty lines or lines with only whitespace.
Chameleon: Sort Sort "direction" Sorts lines alphabetically (ascending by default).
Chameleon: Shuffle Shuffle None Randomizes the order of the lines.
Chameleon: Join Join "separator" Joins all affected lines into a single string using the separator.
Chameleon: Split Split "separator" Splits each line into multiple lines using the separator.

Insertion & Replacement

Command Palette Script Name Arguments Description
Chameleon: Prepend Prepend "text" Adds text at the beginning of each line.
Chameleon: Append Append "text" Adds text at the end of each line.
Chameleon: Format Format "sep", "pattern" Splits the line by separator and reconstructs it using placeholders (e.g., $0).
Chameleon: Replace Replace "search", "repl" Replaces text. Supports literal search or regex (using /pattern/flags). Allows $1 capture groups and \/ for forced literals.
Chameleon: Extract Extract "regex" Extracts only the part of the line matching the regex.
Chameleon: Enumerate Enumerate "format" Inserts a sequential number in each line (e.g., $i.).

Trimming & Padding

Command Palette Script Name Arguments Description
Chameleon: Trim Trim None Removes whitespace at the beginning and end of each line.
Chameleon: Normalize Whitespace NormalizeWhitespace None Reduces multiple spaces to a single space.
Chameleon: Pad Left PadLeft "length", "char" Pads the left side of the line with a character until a specific length.
Chameleon: Pad Right PadRight "length", "char" Pads the right side of the line with a character until a specific length.
Chameleon: Remove First Chars RemoveFirstChars "count" Removes the first N characters of each line.
Chameleon: Remove Last Chars RemoveLastChars "count" Removes the last N characters of each line.
Chameleon: Remove First Words RemoveFirstWords "count" Removes the first N words of each line.
Chameleon: Remove Last Words RemoveLastWords "count" Removes the last N words of each line.

Casing

Command Palette Script Name Arguments Description
Chameleon: To Lowercase ToLower None Converts text to lowercase.
Chameleon: To Uppercase ToUpper None Converts text to UPPERCASE.
Chameleon: To Title Case ToTitle None Converts text to Title Case.
Chameleon: To Sentence Case ToSentence None Converts text to Sentence case.
Chameleon: To camelCase ToCamel None Converts text to camelCase.
Chameleon: To PascalCase ToPascal None Converts text to PascalCase.
Chameleon: To snake_case ToSnake None Converts text to snake_case.
Chameleon: To kebab-case ToKebab None Converts text to kebab-case.

Encoding & Data Transformation

Command Palette Script Name Arguments Description
Chameleon: Html Encode HtmlEncode None Converts special characters to HTML entities.
Chameleon: Html Decode HtmlDecode None Decodes HTML entities to original characters.
Chameleon: Json Stringify JsonStringify None Escapes text to be valid inside a JSON string.
Chameleon: Json Parse JsonParse None Parses a JSON string and extracts its text value.
Chameleon: Url Encode UrlEncode None Encodes a string as a valid Uniform Resource Identifier (URI) component.
Chameleon: Url Decode UrlDecode None Decodes a Uniform Resource Identifier (URI) component.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft