A simple, link-based dotfiles manager that works across Linux and Windows.
Mainly for personal use. Feel free to use or take inspiration from it
Disclaimer: do note that this project is fully AI generated. I do use it personally and so far there are no issues (main commands that I usually use: init, add, add with --link-to, sync), but be aware that some things might be missed, and therefore always back up your stuff beforehand. I will not be responsible for any damage caused.
Second Disclaimer: I only tested this on Linux and have not yet tested this on Windows (or Mac, I don't have an Mac). My Windows just recently got corrupted and I did not have time to set Windows back up for the time being.
This is a pure Python script - no compilation or build process needed. Just make it executable and run.
# Make the script executable
chmod +x dotfiles
# Optionally add to your PATH
sudo ln -s /path/to/dotfiles /usr/local/bin/dotfiles# Create and initialize in one step
mkdir ~/dotfiles
dotfiles init ~/dotfilesThis creates a .dotfiles.json config file and sets it as the default directory.
You can run dotfiles from anywhere - it will search for the config file upward, or you can specify explicitly:
# From anywhere - auto-detects dotfiles folder by searching upward
dotfiles add ~/.config/hypr
# Specify dotfiles folder explicitly with -d/--dotfiles-dir
dotfiles add ~/.config/nvim -d ~/dotfiles
# Or use environment variable
export DOTFILES_DIR=~/dotfiles
dotfiles add ~/.config/nvim
# Specify destination path explicitly
dotfiles add ~/.config/nvim --platform linux ~/.config/nvim
# Add for multiple platforms at once
dotfiles add ~/.config/hypr --platform linux ~/.config/hypr --platform windows "%LOCALAPPDATA%/Hypr"
# Use --link-to to specify custom symlink destination
dotfiles add neovim-config --link-to ~/.config/nvimThe file/folder is moved to the dotfiles folder and a link record is created.
If you already have files in your dotfiles folder and want to create symlinks manually, use record:
# Record an existing symlink
dotfiles record ~/.config/nvimCreate symlinks from the dotfiles folder to their original locations:
# Auto-detect current platform
dotfiles sync
# Specify platform explicitly
dotfiles sync --platform linux
dotfiles sync -d ~/dotfiles --platform windows# List all tracked dotfiles
dotfiles list
# Edit link record paths
dotfiles edit nvim --platform linux ~/.config/nvim
# Restore files from dotfiles (convert symlink to real files)
dotfiles restore nvim --platform linux
# Remove from tracking (with prompt for file deletion)
dotfiles remove nvim
# Remove only a specific platform from records
dotfiles remove nvim --platform windowsThe dotfiles directory is resolved in this order:
-d/--dotfiles-dircommand line argument- Global default config (
~/.dotfiles_default) DOTFILES_DIRenvironment variable- Auto-detect by searching upward from current directory
You can also set a default directory:
dotfiles default ~/dotfiles # Set default
dotfiles default # Show current default| Command | Description |
|---|---|
-d/--dotfiles-dir <path> |
Specify dotfiles folder |
init [path] |
Initialize directory as dotfiles folder (default: current) |
add <path> |
Add file/folder to dotfiles (auto-detects platform) |
add <path> --platform <plat> [path] |
Add with specific platform destination |
add <path> --link-to <path> |
Add with custom symlink destination |
record <path> |
Record an existing symlink without moving |
edit <name> |
Edit link record paths (interactive) |
edit <name> --platform <plat> [path] |
Edit specific platform path |
sync |
Sync all links for current platform |
sync --platform <plat> |
Sync for specific platform |
restore <name> |
Restore from dotfiles (current platform) |
restore <name> --platform <plat> |
Restore for specific platform |
remove <name> |
Remove entry, prompt for file deletion |
remove <name> --platform <plat> |
Remove only platform from records |
list |
List all link records |
default [path] |
Set or show default dotfiles directory |
-h, --help- Show help message-d <path>, --dotfiles-dir <path>- Path to dotfiles folder--platform <platform>, -p <platform>- Specify platform (linux, windows, macos)
Environment Variable: Set DOTFILES_DIR=~/dotfiles to avoid passing -d every time.
# Run all tests
python3 -m pytest tests/
# Run with verbose output
python3 -m pytest tests/ -v
# Run specific test file
python3 -m pytest tests/test_commands.py -v- Linux - Full support with symlinks
- Windows - Untested
- macos - Untested
- Add: Moves your config file/folder to the dotfiles folder and records the path
- Sync: Creates symlinks from the original location to the dotfiles folder
- Restore: Removes symlink and copies files back to original location
- Link records: Stored in
.dotfiles.jsonwith per-platform paths