🕷 zenspider.com

by ryan davis



sitemap
Looking for the Ruby Quickref?

CDPATH

Published 2012-06-21 @ 00:00

Tagged productivity, omnifocus

This is part of the Productivity Pr0n series.

Watching tenderlove work is sometimes painful. Besides watching him flounder in vim, he spends a fair amount of his day in the terminal getting lost across all his projects. Between that and all the photos of his cat, gorby… it’s just sad, really. Maybe I should drink.

If only he knew of CDPATH and used it regularly. All he’d have to do is add something like this to his .bashrc:

export CDPATH=.:~:~/Links:~/Work/git

Then he can fill ~/Links with symlinks like:

% cd ~/Links
% ln -s ../Sites/tenderlovemaking.com BLOG
% echo etc...

From there, anytime cd doesn’t find the directory relative to the current location, then cd will consult the directories in CDPATH. Voila:

% cd rails
/Users/aaron/Work/git/rails              # via ~/Work/git
% cd BLOG
/Users/aaron/Links/BLOG
% pwd
/Users/aaron/Sites/tenderlovemaking.com/ # via ~/Links/BLOG

Navigating wide and varied directories is just a matter of setting up CDPATH and/or symlinks.

Now if only I could re-inflate gorby’s. flat. face.