Skip to main content

Manage and edit $HOME dotfiles using Python + git = <3

Project description

mydot -- A Python module for managing dotfiles

Super-charged version of the Atlassian approach to managing dotfiles using a bare git repo + fzf magic! Quickly edit files, add changes, run scripts, grep through dotfiles, or discard work-tree changes with ease.

Quick Start

  1. Install dependencies:

    sudo apt install fzf git    # Ubuntu/Debian
    brew install fzf git        # MacOS/Homebrew
    
  2. Configure shell: At the bottom of your ~/.bashrc or ~/.zshhrc add:

    export DOTFILES="$HOME/.config/dotfiles"
    alias config='/usr/bin/git --git-dir=$DOTFILES --work-tree=$HOME'
    

    what and why?:

    • DOTFILES: variable pointing to your local --bare dotfiles repository
  3. Initialize dotfiles repository: Reload shell config with source ~/.bashrc or source ~/.zshhrc then:

    mkdir -pv $DOTFILES         # create directory
    git init --bare $DOTFILES   # initialize the repository
    
  4. Install mydot and disable viewing of untracked files

    pip install --user mydot
    mydot git config --local status.showUntrackedFiles no
    
  5. Add files to your dotfiles repo

    mydot git add ~/.vimrc ~/.tmux.conf ~/.bashrc ~/.bash_aliases ~/.zshrc
    mydot git commit -m "the journey of a thousand miles begins with one step"
    

    protip: You can use all your regular git commands, including aliases, when calling d. git

  6. Feel the power with mydot (and the pre-installed alias d.)

    d. -e       # choose file(s) to open in $EDITOR
    d. -a       # choose modified files to add file(s) to staging area
    d. -r       # select an executable file to run
    d. -g       # grep through tracked dotfiles and open from matches
    d. -s       # see the state of your repo
    d. -l       # list all files under version control
    
    d. --export     # make a tarball of your dotfiles + bare git repo
    d. --clip       # put file paths into the clipboard
    
    d. --restore    # remove files from staging area
    d. --discard    # discard unstaged changes from work tree
    
    d.          # see the help message whihc details available commands
    

Going Deeper

Useful aliases

alias es="mydot --edit"     # quick select a file to edit
alias rs="mydot --run"      # quick select a script to run

If you ever run into an issue where the mydot CLI is reading flags meant for mydot git you can fallback to the config alias from step 1 which acts as a special git command that only applies for the dotfiles repo.

Source of Truth

This project is available on GitHub and GitLab. Each push to master automatically goes to both so choose whichever platform you prefer. All releases are published to PyPi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mydot-0.7.0.tar.gz (17.3 kB view hashes)

Uploaded Source

Built Distribution

mydot-0.7.0-py3-none-any.whl (16.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page