dotts

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:

VariableDescription
user.nameYour full name
user.emailYour email address
user.githubYour GitHub username

System Information

Automatically detected:

VariableDescription
system.hostnameMachine hostname
system.osOperating system (linux, darwin)
system.distroLinux distribution
system.archCPU architecture

Settings

Any settings from your profile chain:

VariableDescription
settings.shellConfigured shell
settings.editorConfigured editor
settings.themeColor 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 yes

Shell 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

  1. dotts detects files with <<dotts:...>> placeholders
  2. Values are resolved from your personal config and settings
  3. The file is processed and written to the target location
  4. 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 templates

Personal Config

Your personal information is stored locally (never committed):

~/.local/share/dotts/personal.yaml
name: Your Name
email: you@example.com
github: yourusername

This 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: hyprland

Use in templates:

# hyprland.conf
# Auto-generated for <<dotts:settings.monitors>> monitors

Best Practices

  1. Use for secrets - Keep emails, names, and keys out of git
  2. Keep it simple - Templates work best for simple substitutions
  3. Document variables - Add comments showing expected values
  4. Test locally - Run dotts update --dry-run to 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 --verbose

This shows all available template variables and their current values.

On this page