by wrboyce · 6y ago · 0 comments
setopt autocd
hash -d dev=~/dev
Now I can just use `~dev` to `cd ~/dev` but I can also do `~dev/foo/bar/baz` etc.e.g. `z p` might take you to ~/projects if you've been there recently.
export SITES=$HOME/Sites
# Plural to cd and list contents
alias sites="cd $SITES; ll"
# Singular to access a particular project
site() { cd $SITES/$1; }
# Autocomplete function
_site() { _directories -W $SITES -/; }
compdef _site site
It works from within any directory, which is nice. site f[tab][enter]
takes me to $SITES/foo/For example if I'm in "/Documents/Dotfiles", but want to go to "/Documents/Blog". Doing the "../" dance is tedious as hell.
% Documents/Dotfiles
[~/Documents/Dotfiles] % ../Blog
This does the trick.