Align Colon-Delimited Configuration Data
Align key-value pairs separated by colons, common in YAML-like configs, properties files, and system output.
Delimiter Types
Detailed Explanation
Aligning Colon-Delimited Data
Colons are used as key-value separators in YAML files, Java .properties alternatives, systemd unit files, /etc/passwd, and many configuration formats. Aligning on the colon makes the structure immediately clear.
Before
server.host: 0.0.0.0
server.port: 8080
database.url: jdbc:postgresql://localhost:5432/mydb
database.pool.max: 20
cache.ttl: 3600
log.level: info
log.format: json
After
server.host : 0.0.0.0
server.port : 8080
database.url : jdbc:postgresql://localhost:5432/mydb
database.pool.max: 20
cache.ttl : 3600
log.level : info
log.format : json
How the Tool Handles Colons
When you select Colon : as the delimiter, the tool splits each line on the first colon encountered. This is important because values themselves may contain colons (as in the JDBC URL example above). The split produces exactly two columns: the key and the value.
Tips
- If your values contain colons and you need to split on a specific pattern like
:(colon with surrounding spaces), use the Custom delimiter option instead. - For YAML files specifically, aligning on colons can improve readability but be aware that YAML is whitespace-sensitive and adding padding may change the semantics. Always validate the result.
- Use left-alignment for both key and value columns for maximum readability.
Use Case
A Java developer formats a Spring Boot application.properties file with colon separators, aligning keys so that all values start at the same column position.