Dotfiles are used to configure and personalize your computer environment. This is the collection of files I use when spinning up a new machine (MacOS or Ubuntu).
Before you use these, browse the contents of the repository and see how all the components work together and mesh with your needs. Then go ahead and fork it, remove what you don't need, and build on the rest to create your own flavor.
To install, run the appropriate command for your system.
setup.sh
command if you don't fully understand how it works. It can cause trouble on an already configured system.
bash -c "$(curl -fsSL https://raw.githubusercontent.com/petemcw/dotfiles/master/src/os/setup.sh)"
bash -c "$(wget -qO - https://raw.githubusercontent.com/petemcw/dotfiles/master/src/os/setup.sh)"
✨ All done! ✨
To update the repository with any new changes and re-run the setup process, simply run the setup.sh
script. You can also update a particular component by running the appropriate script.
You can easily extend the functionality provided by this repository on a local, per-environment basis using the following files.
The ~/.gitconfig.local
file will be created for you during installation. It's contents are up to you and will be included after content from ~/.gitconfig
allowing you to overwrite and add to the default config.
Example: Use ~/.gitconfig.local
to store sensitive information such as credentials:
[commit]
# Sign commits using GPG.
# https://help.github.com/articles/signing-commits-using-gpg/
gpgsign = true
[user]
signingkey = XXXXXXXX
The ~/.localrc
file will be created for you during installation. It's contents are up to you and will be sourced after all other Zsh related files allowing you to overwrite and add to the default config.
Example: Use ~/.localrc
to store sensitive information such as credentials:
#!/usr/local/bin/zsh
# Set environment
export HOMEBREW_GITHUB_API_TOKEN='XXXXXXXX'
export DIGITAL_OCEAN_TOKEN='XXXXXXXX'
# Path additions
export PATH="$PATH:$HOME/.bin"
The ~/.vimrc.local
file will be created for you during installation. It's contents are up to you and will be sourced after content from ~/.vimrc
allowing you to overwrite and add to the default config.
Shown with Solarized Dark color scheme and Powerline-patched Inconsolata 18pt (Unicode) / Powerline-patched DejaVu Sans Mono 14pt (Non-ASCII) in iTerm 2.
Install one of the patched fonts from Powerline or patch your own for the special characters. Optionally set DEFAULT_USER
in ~/.zshenv
to your username to hide the user on hostname
info when you’re logged in as yourself on your local machine.
Variable | Default Value | Description |
---|---|---|
DOUBLEUP_VERBOSE_BG_JOBS |
true |
If there is more than one background job, this segment will show the number of jobs. Set this to false to turn this feature off. |
This segment shows the return code of the last command.
Variable | Default Value | Description |
---|---|---|
DOUBLEUP_VERBOSE_STATUS |
false |
Set to true if you wish to show actual return code when the last command fails. |
Variable | Default Value | Description |
---|---|---|
DOUBLEUP_TIME_FORMAT |
'H:M:S' | ZSH time format to use in this segment. |
As an example, if you wanted a reversed time format, you would use this:
# Reversed time format
DOUBLEUP_TIME_FORMAT='%D{%S:%M:%H}'
By default, the vcs
segment will provide quite a bit of information. Further customization is provided via:
Variable | Default Value | Description |
---|---|---|
DOUBLEUP_VCS_HIDE_TAGS |
true |
Set to false to allow tags being displayed in the segment. |
DOUBLEUP_VCS_SHOW_CHANGESET |
false |
Set to true to display the hash in the segment. |
DOUBLEUP_VCS_INTERNAL_HASH_LENGTH |
8 |
How many characters of the hash to display in the segment. |
The setup.sh
script is a simple installer that will prompt for some info, check dependencies, set default preferences, install common apps, and so on.
Here's what happens during install:
- The repository is cloned into your home folder at
~/.dotfiles
- If this isn't the first run, you'll be asked if you want to update the repository with an new commits
- Some additional directories will be created
- Files with user-provided content will be copied
- Any file or directory name ending in
.copy
will get linked into the home directory
- Any file or directory name ending in
- Symlinks for Git, Shell, and Vim configurations will created in
~/
- Any file or directory name ending in
.symlink
will get linked into the home directory
- Any file or directory name ending in
- Applications and command-line tools are installed for MacOS & Ubuntu
- Python-powered Powerline will be installed
- Vim plugins are installed
- Sane preferences are set for MacOS & Ubuntu
- Finally,
zsh
will be set as the default shell
Unfortunately you won't be able to test your ~/.dotfiles
natively on MacOS using Docker. Instead you'll need to build a VirtualBox machine or try it out in a separate user account on your existing system.
A great way to test changes to your ~/.dotfiles
on Linux is by using Docker.
This repository contains a simple configuration for a basic Ubuntu container. Assuming your host system has Docker & Docker Compose properly installed:
docker compose build
To test the online installation, create a self-removing container like so:
docker run -it --rm petemcw/dotfiles
To test a local dotfiles
repository, mount as a volume in your self-removing container:
docker run -it --rm -v $PWD:/root/.dotfiles petemcw/dotfiles
If you fork this project for your own use, awesome! Just don't forget to update/customize the following:
- Links in this README.md
- Environment variables in the
setup.sh
script - Login Window text preference
So much inspiration and code has been gleaned from many talented people over the years, including but not limited to:
The code uses the MIT license.