AHK_File_Edit_Small
Make targeted edits to AutoHotkey files with regex or literal replacements, line operations, multi-file batches, and optional previews for lightweight modifications.
Instructions
Token-efficient editor for small, targeted changes. Ideal when you need a lightweight replace or line edit without loading the full diff engine. Supports regex and literal replacements, multi-file batches, optional diff previews, and dry-run mode.
Common Replace
Insert Before a Line (Preview)
Multi-File Regex Replace
What to Avoid
Mixing deprecated "content" parameter with newContent - prefer newContent
Running multi-file edits without
dryRun: trueto previewForgetting
backup: truewhen touching critical scripts
See also: AHK_File_Edit (full-featured editor), AHK_File_Edit_Diff (complex diffs), AHK_File_Edit_Advanced
π Active File: Not set. Use AHK_File_Active to select a target.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | Edit action to perform (default: replace_literal for safe string matching) | replace_literal |
| file | No | Target file to edit. Defaults to the active file when omitted. | |
| files | No | Apply the same edit to multiple files. | |
| find | No | Text (or pattern) to search for when using replace actions. | |
| replace | No | Replacement text for replace actions. | |
| regexFlags | No | Additional RegExp flags (e.g. "i" for case-insensitive). | |
| all | No | Replace all occurrences (false = first only). | |
| line | No | Line number for line-based actions (1-based). | |
| startLine | No | Start line for range operations (1-based). | |
| endLine | No | End line for range delete or replace (1-based, inclusive). | |
| content | No | β οΈ Deprecated alias for newContent. Prefer newContent for new text. | |
| newContent | No | Content to insert or replace when using line actions. Example: "MsgBox(\"Done\")". | |
| preview | No | Show a unified diff instead of writing to disk. | |
| dryRun | No | Preview changes without modifying file. Shows affected lines and change count. | |
| backup | No | Create a .bak backup before writing changes. | |
| runAfter | No | Run the script after edits complete (single file only). |