My dotfiles, managed with GNU Stow.
This repository contains my personal configuration files, organized as modular packages.
Each package can be easily installed using GNU Stow.
- GNU Stow installed on your system:
# Debian / Ubuntu
sudo apt install stow
# Arch
sudo pacman -S stow
# Fedora
sudo dnf install stow- Linux machine (not tested on macOS, but may work there too...)
Each top-level directory is a package that will be symlinked into your home directory.
Example of how Stow symlinks will be created based on corresponding directories:
dotfiles/
├── vim/.vimrc → ~/.vimrc
├── prettier/.prettierrc → ~/.prettierrc
├── bin/bin/some-script → ~/bin/some-script
├── bash/.config/bash/prompt.sh → ~/.config/bash/prompt.sh
├── git/.gitconfig → ~/.gitconfig
To further explain:
- If a package contains a file, Stow will create a symlink to that file in your
$HOME. - If a package contains a subdirectory, the corresponding directory (and any parent directories) must already exist in your
$HOMEbefore running Stow.- For more details, see Packages Containing Directories below.
Clone this repository into your home directory:
git clone https://github.com/CodeZea1ot/dotfiles.git ~/dotfilesNavigate to this repository and install one or more packages using GNU Stow:
# Example: Install vim package after performing a dry-run
cd ~/dotfiles
stow -n -v vim # Optional dry-run
stow vim # Example: Install the vim packageSome packages include directories that must exist in your home folder before Stow can link the contents.
For example, the bin package contains scripts intended for ~/bin.
Before running:
cd ~/dotfiles
stow binyou must ensure that the target directory exists:
mkdir -p ~/binThis is because GNU Stow only creates symlinks for files; it does not automatically create the target directory itself or any nested subdirectories.
Once the corresponding directories exists, Stow will correctly link the files the package into it.
ⓘ Tip For packages that install into directories like ~/bin, ~/local/share/fonts, or ~/.config, always create the corresponding directories first. Stow will then handle linking the files correctly.
ⓘ Note The bash package does not directly replace your existing
~/.bashrc. See Bash Package below — it requires a small manual step to source the configuration.
To remove all of the symlinks for a package created by GNU Stow:
cd ~/dotfiles
stow -D vim # Example: Delete the symlinks for the vim packageⓘ Note If you created corresponding directories for a package before using Stow to create symlinks, you could optionally remove them.
The bash package aims to be as modular as possible.
To use the bash package, you must add this to your ~/.bashrc:
# Load user bash config (dotfiles)
if [ -f "$HOME/.config/bash/bashrc" ]; then
source "$HOME/.config/bash/bashrc"
fiAll the files in the bash package live in ~/.config/bash.
I refer to the .sh files in that directory as "submodules" of the bash package.
This keeps your distro-provided ~/.bashrc intact while allowing your dotfiles to be sourced cleanly.
After updating your ~/.bashrc, install with:
cd ~/dotfiles
stow bash
source ~/.bashrc # Source to run (dotfiles) block on stowed submodulesThe bash package loads submodules via scripts and a loop.
You can easily opt-out of submodules by defining your own values for $BASH_SUBMODULES.
Here is an example of opting out of the use of ~/dotfiles/bash/.config/bash/prompt.sh.
# File: `~/.bashrc`
export BASH_SUBMODULES="aliases exports funcs" # note, prompt is not listedIf you do not export BASH_SUBMODULES in your environment, all submodules will be enabled by default.
Remove the following block from your ~/.bashrc:
# Load user bash config (dotfiles)
if [ -f "$HOME/.config/bash/bashrc" ]; then
source "$HOME/.config/bash/bashrc"
fiThen remove the bash package symlinks:
cd ~/dotfiles
stow -D bashThe git package makes it easy to configure ~/.gitconfig on a new machine.
If you decide to use this package, you will need to have a ~/.gitconfig_personal file that contains information that should not be in version control.
# Private Git configuration for this machine
# Must be included via main ~/.gitconfig:
# [include]
# path = ~/.gitconfig_personal
[user]
name = First Last
email = me@somewhere.com
ⓘ Note If you have the bin package installed, you can generate or update
~/.gitconfig_personalby runninggit-personal --name "Full Name" --email me@somewhere.com [-u | --update]
On write, BASH files will try to run shellcheck as a linter.
# Install linter so :w does not complain
sudo apt install shellcheckKeybind: Leader + f
Using this keybind will call a formatter based on the filetype.
The formatter will format the code and save the file before redrawing the vim buffer.
The following formatters must be installed and in your $PATH if you wish to use this keybind.
# JS, TS, HTML, CSS, JSON files use Prettier
npm install -g prettier
prettier --version # Verify install success
# Python files use Black
sudo apt install pipx
pipx ensurepath
source ~/.bashrc
pipx install black
black --version # Verify install success
# Go files will use gofmt from the standard library
# BASH files will use shfmt
sudo apt install shfmtKeybind: Leader + F
Using this keybind will toggle format on save.
The status bar in vim will show if it is on.