Templates
Using template variables in your dotfiles
Templates
dotts supports template placeholders in your config files. These are replaced with actual values during the linking process, allowing you to keep personal information out of your repository while still using it in your configs.
Syntax
Template placeholders use the format:
<<dotts:variable.name>>For example:
[user]
name = <<dotts:user.name>>
email = <<dotts:user.email>>Available Variables
User Information
These are collected during dotts init:
| Variable | Description |
|---|---|
user.name | Your full name |
user.email | Your email address |
user.github | Your GitHub username |
System Information
Automatically detected:
| Variable | Description |
|---|---|
system.hostname | Machine hostname |
system.os | Operating system (linux, darwin) |
system.distro | Linux distribution |
system.arch | CPU architecture |
Settings
Any settings from your profile chain:
| Variable | Description |
|---|---|
settings.shell | Configured shell |
settings.editor | Configured editor |
settings.theme | Color theme |
settings.* | Any custom setting |
Examples
Git Configuration
# configs/git/.config/git/config
[user]
name = <<dotts:user.name>>
email = <<dotts:user.email>>
signingkey = <<dotts:user.email>>
[github]
user = <<dotts:user.github>>SSH Config
# configs/shell/.ssh/config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yesShell Greeting
# configs/shell/.config/fish/config.fish
set -g fish_greeting "Welcome back, <<dotts:user.name>>!"Template Processing
Templates are processed during dotts init and dotts update. The resolved files are written to your home directory (not symlinked).
How It Works
- dotts detects files with
<<dotts:...>>placeholders - Values are resolved from your personal config and settings
- The file is processed and written to the target location
- A record is kept in the manifest for future updates
Updating Templates
When you run dotts update, template files are re-processed with current values:
dotts update
# Re-processes any files containing templatesPersonal Config
Your personal information is stored locally (never committed):
~/.local/share/dotts/personal.yamlname: Your Name
email: you@example.com
github: yourusernameThis file is created during dotts init and can be edited manually.
Settings in Templates
Profile settings are also available:
# profiles/desktop.yaml
settings:
monitors: 3
compositor: hyprlandUse in templates:
# hyprland.conf
# Auto-generated for <<dotts:settings.monitors>> monitorsBest Practices
- Use for secrets - Keep emails, names, and keys out of git
- Keep it simple - Templates work best for simple substitutions
- Document variables - Add comments showing expected values
- Test locally - Run
dotts update --dry-runto preview
Don't use templates for complex logic. For that, consider using separate alternate files or external scripts.
Debugging
To see the resolved values:
dotts status --verboseThis shows all available template variables and their current values.