Align Configuration File Key-Value Pairs
Align key-value pairs in configuration files (INI, TOML, properties) for a clean, organized appearance.
Detailed Explanation
Formatting Configuration Files
Configuration files in various formats — INI, TOML, Java properties, NGINX configs — use different delimiters between keys and values but share the same readability benefit from proper alignment.
INI-Style (equals sign)
[database]
host=localhost
port=5432
name=production_db
user=app_user
password=encrypted_value
pool_size=25
max_idle=5
connection_timeout=10
After
[database]
host =localhost
port =5432
name =production_db
user =app_user
password =encrypted_value
pool_size =25
max_idle =5
connection_timeout =10
Handling Section Headers
In INI files, section headers like [database] do not contain the delimiter character and will be treated as single-column rows. The tool handles this gracefully — the header line passes through unchanged while the key-value lines below it are aligned.
Multi-Section Files
If your configuration file has multiple sections, you can align the entire file at once. Each section's keys will be padded to the same maximum width across the whole file. If you prefer per-section alignment, split each section into a separate alignment pass.
Preserving Comments
Lines starting with # or ; (common comment markers) that do not contain the delimiter character will pass through as single-column rows. They are not modified, so your comments remain intact.
Format-Specific Notes
- TOML — uses
=between keys and values; alignment is purely cosmetic and does not affect parsing. - Java .properties — can use
=or:; choose the appropriate delimiter. - NGINX — uses spaces between directives and values; use Spaces (2+).
Use Case
A backend developer is organizing a large application configuration file with 50+ settings and wants a clean, scannable layout for peer review.