A dotfiles and configuration management system that helps you sync your shell scripts and dotfiles across different machines using git.
This repository provides a set of tools to:
- Install your dotfiles and scripts to your home directory
- Backup your current dotfiles and scripts back to the repository
- Sync configurations across different machines
- Manage custom shell scripts in a centralized location
.
├── src/ # Source scripts (with .sh extension) - tracked in git
│ ├── install-scripts.sh
│ ├── backup-scripts.sh
│ ├── install-dotfiles.sh
│ └── backup-dotfiles.sh
├── scripts/ # Your custom shell scripts - tracked in git
│ ├── confedit.sh
│ └── lolprint.sh
├── dotfiles/ # Your dotfiles (with nested structure) - tracked in git
│ ├── .zshrc
│ ├── .tmux.conf
│ └── .config/
│ ├── nvim/
│ └── alacritty/
├── config.yml # Configuration file - tracked in git
└── build.sh # Build script - tracked in git
./build.shThis will:
- Create the
bin/directory if it doesn't exist - Copy all
.shfiles fromsrc/tobin/ - Remove the
.shextension (e.g.,install-scripts.sh->install-scripts) - Make them executable
After building, you'll have these executables in bin/:
bin/install-scriptsbin/backup-scriptsbin/install-dotfilesbin/backup-dotfiles
Install all dotfiles defined in config.yml to your home directory:
./bin/install-dotfilesThis will:
- Read dotfile paths from
config.yml - Copy files from
dotfiles/to$HOME/ - Create necessary directories
- Backup existing files before overwriting
Install custom scripts to $HOME/.custom/scripts/bin:
./bin/install-scriptsThis will:
- Copy all
.shfiles fromscripts/to$HOME/.custom/scripts/bin - Remove the
.shextension - Make them executable
Installs shell scripts from the scripts/ directory to $HOME/.custom/scripts/bin.
./bin/install-scriptsWhat it does:
- Finds all
.shfiles inscripts/ - Copies them to
$HOME/.custom/scripts/bin(without.shextension) - Makes them executable
- Shows which files were installed
Backs up scripts from $HOME/.custom/scripts/bin to the scripts/ directory.
./bin/backup-scriptsWhat it does:
- Reads all executable files from
$HOME/.custom/scripts/bin - Copies them back to
scripts/(adding.shextension) - Compares files to detect changes
- Shows which files were updated
Installs dotfiles from dotfiles/ to your home directory based on config.yml.
./bin/install-dotfilesWhat it does:
- Parses dotfile paths from
config.yml - Copies files from
dotfiles/to$HOME/ - Maintains nested directory structure (e.g.,
.config/nvim/init.vim) - Creates necessary directories
- Backs up existing files before overwriting
Backs up dotfiles from your home directory to dotfiles/ based on config.yml.
./bin/backup-dotfilesWhat it does:
- Reads dotfile paths from
config.yml - Copies current files from
$HOME/todotfiles/ - Maintains nested directory structure
- Compares files to detect changes
- Shows which files were updated
The config.yml file defines which dotfiles to manage:
dotfiles:
- .zshrc
- .bashrc
- .bash_profile
- .profile
- .tmux.conf
- .config/nvim/init.vim
- .config/nvim/coc-settings.json
- .config/nvim/extra.vim
- .config/alacritty/alacritty.yml
uname: DarwinFields:
dotfiles: List of dotfile paths relative to$HOMEuname: Expected operating system (e.g.,Darwin,Linux)
The scripts will warn you if the uname in config.yml doesn't match your system's uname -s.
The dotfiles/ directory mirrors the structure of your home directory. For example:
dotfiles/.zshrc_>$HOME/.zshrcdotfiles/.config/nvim/init.vim->$HOME/.config/nvim/init.vim
- Clone this repository
- Build the scripts first (required!):
./build.sh- This creates the
bin/directory with executable scripts
- This creates the
- Install dotfiles:
./bin/install-dotfiles - Install scripts:
./bin/install-scripts
- Make changes to your dotfiles in
$HOME/ - Backup changes:
./bin/backup-dotfiles - Commit and push changes
- Add the path to
config.yml:dotfiles: - .newfile
- Copy the file to
dotfiles/:cp ~/.newfile dotfiles/.newfile - Commit the changes
- Edit scripts in
scripts/ - Install them:
./bin/install-scripts - Or edit them directly in
$HOME/.custom/scripts/bin/ - Backup changes:
./bin/backup-scripts - Commit the changes
If you modify scripts in src/, you need to rebuild:
- Edit scripts in
src/(e.g.,src/install-dotfiles.sh) - Rebuild:
./build.sh - The updated executables will be in
bin/
- Git: Required for finding the project root
- Bash: All scripts are written in bash
- lolcat (optional): For rainbow-colored output
- The
bin/directory is not tracked in git - you must run./build.shafter cloning to generate the executables - Scripts in
bin/are executable files without extensions (generated fromsrc/) - Scripts in
scripts/have.shextensions - The
build.shscript removes the.shextension when copying tobin/ - All scripts must be run from within the git repository
- If you update scripts in
src/, rebuild with./build.shto updatebin/
These configurations have been tested and are actively used on macOS. They have not been tested recently on Linux, though the scripts should work on Linux systems as well.
If you encounter any issues on Linux or other platforms, or if you'd like to contribute improvements for cross-platform compatibility, please feel free to:
- Open an issue describing the problem
- Submit a pull request with fixes or improvements
- Share your testing results
Contributions are welcome! 🎉
This project is originally inspired by adotg/.dotfiles.