This repository contains my personal configuration files (dotfiles) managed using GNU Stow.
GNU Stow is a symlink manager that helps keep dotfiles organized.
sudo pacman -S stow
brew install stow
git clone git@github.com:yourusername/dotfiles.git ~/dotfiles
cd ~/dotfiles
Each application's configuration is stored in a separate folder inside ~/dotfiles
.
~/dotfiles/
├── bash/
│ └── .bashrc
├── vim/
│ └── .vimrc
├── git/
│ └── .gitconfig
├── nvim/
│ └── .config/nvim/init.lua
├── alacritty/
│ └── .config/alacritty/alacritty.yml
├── i3/
│ └── .config/i3/config
To create symlinks from ~/dotfiles
to the home directory:
stow bash
stow vim
stow git
stow nvim
stow alacritty
stow i3
This will symlink:
~/dotfiles/bash/.bashrc
→~/.bashrc
~/dotfiles/vim/.vimrc
→~/.vimrc
~/dotfiles/nvim/.config/nvim/
→~/.config/nvim/
Check if the symlinks are correctly created:
ls -l ~/.bashrc ~/.vimrc ~/.gitconfig ~/.config/nvim
To remove symlinks but keep the files, use:
stow -D bash
stow -D vim
If Stow warns about existing files, delete them first:
rm -rf ~/.bashrc ~/.vimrc ~/.gitconfig ~/.config/nvim
Then re-run:
stow bash
stow vim
stow git
stow nvim
cd ~/dotfiles
git init
git add .
git commit -m "Initial commit of dotfiles"
git remote add origin git@github.com:yourusername/dotfiles.git
git push -u origin main
On a fresh install, restore your setup with:
git clone git@github.com:yourusername/dotfiles.git ~/dotfiles
cd ~/dotfiles
stow bash
stow vim
stow git
stow nvim
stow alacritty
stow i3
If a folder (e.g., nvim/.config/nvim/
) is an embedded Git repository, remove its .git
directory or use Git submodules.
rm -rf ~/dotfiles/nvim/.config/nvim/.git
git rm --cached nvim/.config/nvim
git submodule add <nvim-repo-url> nvim/.config/nvim
git commit -m "Added Neovim as a submodule"
When cloning your dotfiles later:
git clone --recursive <your-dotfiles-repo-url>
git submodule update --init --recursive
Create setup.sh
to automatically apply all symlinks:
nano ~/dotfiles/setup.sh
Paste this:
#!/bin/bash
DOTFILES_DIR="$HOME/dotfiles"
cd "$DOTFILES_DIR" || exit
for folder in */; do
stow "${folder%/}"
done
echo "Dotfiles have been successfully linked!"
Save and run:
chmod +x ~/dotfiles/setup.sh
./setup.sh
Your dotfiles are now neatly managed using GNU Stow. 🚀