YAML Key Search & Replace
A VS Code extension for searching and replacing YAML keys across your workspace using dot notation with exact matching!
Features
- ** Exact Match Search** - Only finds keys that match exactly (no partial or false positives)
- ** Dot Notation Support** - Search using familiar paths like
database.connection.timeout
- ** Find and Replace** - Replace values across multiple YAML files
- ** Smart Navigation** - Jump directly to matching keys
- ** Bulk Operations** - Replace all or selectively choose which matches to update
How It Works
This extension uses a tree-based flattening algorithm to ensure 100% accurate matching
What Gets Matched
# Searching for "database.host" will find:
# Example 1: Direct dot notation
database.host: "localhost" -> MATCH
# Example 2: Hierarchical structure
database:
host: "localhost" -> MATCH (flattened as "database.host")
# Example 3: Multi-level nesting
app:
database:
host: "localhost" -> NO MATCH (this is "app.database.host", not "database.host")
What WON'T Match
The extension will NOT match these false positives:
# Searching for "database.host" will NOT find:
database_host: "value" -> Different key (underscore vs dot)
database.hostname: "value" -> Different key (hostname vs host)
host: "value" -> Missing parent (this is just "host")
database: "value" -> Incomplete path (no .host)
# Wrong hierarchical context
wrong:
database:
host: "value" -> This is "wrong.database.host", not "database.host"
parent:
database:
host: "value" -> This is "parent.database.host", not "database.host"
Usage
Search Only
Keyboard Shortcut:
- Press
Cmd+Shift+Y (Mac) or Ctrl+Shift+Y (Windows/Linux)
- Enter the key path (e.g.,
database.connection.timeout)
- Press Enter to see all exact matches
- Click any result to jump to that location
Right-Click Menu:
- Select text or place cursor on a word
- Right-click → "Search Selected YAML Key"
Find & Replace
Keyboard Shortcut:
- Press
Cmd+Shift+H (Mac) or Ctrl+Shift+H (Windows/Linux)
- Enter the key path to search
- Enter the new value
- Review and approve changes using the professional interface
Right-Click Menu:
- Select text or place cursor on a word
- Right-click → "Find and Replace Selected YAML Key"
Replace Interface Options
The replace modal provides several options:
- 📋 View All Matches - See file paths, line numbers, and current values
- ☑️ Selective Replacement - Use checkboxes to choose which matches to replace
- 👁️ Preview - Click any match to view it in the editor
- 🔄 Review Each - Git diff-style review for individual changes
- ⚡ Bulk Actions - Replace Selected, Replace All, or Cancel
Use dot notation to represent nested YAML keys:
database:
connection:
host: 'localhost'
port: 5432
timeout: 30
pool:
max-connections: 10
spring:
application:
name: 'my-app'
Valid search paths:
database.connection.host → finds "localhost"
database.connection.port → finds 5432
database.connection.timeout → finds 30
database.pool.max-connections → finds 10
spring.application.name → finds "my-app"
What makes a valid search:
- Must be the complete path from root to leaf
- Path must match exactly (no partial matches)
- Case-sensitive matching
Commands
| Command |
Shortcut |
Description |
| Search YAML Key |
Cmd+Shift+Y / Ctrl+Shift+Y |
Search for exact key path matches |
| Find & Replace YAML Key |
Cmd+Shift+H / Ctrl+Shift+H |
Find and replace key values |
| Search Selected YAML Key |
Right-click menu |
Search for selected text |
| Find & Replace Selected Key |
Right-click menu |
Find and replace selected text |
Configuration
File Exclusion Patterns
Configure which files/directories to exclude from searches:
Settings UI:
- Open Settings (
Cmd+, / Ctrl+,)
- Search for "YAML Key Search"
- Modify "Exclude Patterns"
settings.json:
{
"yamlKeySearch.excludePatterns": [
"**/node_modules/**",
"**/.git/**",
"**/target/**",
"**/build/**",
"**/dist/**",
"**/test/**",
"**/*test*.yml",
"**/*test*.yaml"
],
"yamlKeySearch.includePatterns": [
"**/*.yml",
"**/*.yaml"
]
}
Default Exclusions
By default, these directories are excluded:
**/node_modules/**
**/.git/**
**/target/**
**/build/**
**/dist/**
**/out/**
**/.vscode/**
Supported File Types
License
MIT
Note: This extension uses exact matching to ensure accuracy. If you need fuzzy search or partial matching, please use VS Code's built-in search functionality.