Managing dotfiles using vcsh and mr

This blog post details managing the dotfiles using vcsh and mr.

The two aspects involved in managing dotfiles are:

1. Adding/Tracking the required dotfiles onto vcsh’s local git repository, pushing it to remote repository managed using myrepos.

2. The bootstrap procedure on a new PC.

Phase1:  Initializing environment for dotfiles management

vcsh init mr
vcsh enter mr
cd .config/
mkdir -p mr/{available.d,config.d}
cd mr/available.d/

vim mr.vcsh
checkout = vcsh clone mr

cd ../config.d/
ln -s ../available.d/mr.vcsh
env | grep GIT

vim ~/.mrconfig
git_gc = git gc "$@"
jobs = 5
include = cat /usr/share/mr/vcsh
include = cat ~/.config/mr/config.d/*

git add ~/.mrconfig
git commit -s -a -m 'Sumans .mrconfig'
git remote add origin
git push -u origin master

Phase2:  Adding dotfiles to repository

Lets take an example of managing .vim and .vimrc files.

ln -s ~/.vim/vimrc ~/.vimrc
vcsh init vim
vcsh enter vim
cd .config/mr/available.d/

vim config-vim.vcsh
checkout = vcsh clone config-vim

cd ../config.d/
ln -s ../available.d/config-vim.vcsh
git add .vim
git commit -s -m 'Sumans .vim directory for config-vim bitbucket mr myrepos mgmt'
git remote add origin
git push -force -u origin master

The last command i.e., exit – gets out of vcsh shell.

Verify if the repos are up to date using below command.

$ mr up

Phase3:  Bootstrapping on a new machine:

On a newly installed Ubuntu PC, install vcsh, git and mr.

sudo apt-get install vcsh mr git git-core git-email vim

Now, pull the required repository using below commands

vcsh enter vim
git remote add origin
git pull -u origin master

Your customized vim configuration is up and running on second host up!!!!

An even simpler command would be clone repository using vcsh and do mr up on the new host to pull all your repos automatically.

vcsh clone config-vim
mr up