Added 'c' function to quickly access code directory. Inspired by ryanb.

This commit is contained in:
Mark Glenn 2011-06-30 10:51:36 -05:00
commit 263f0a5dd1
2 changed files with 19 additions and 0 deletions

6
plugins/c/_c Normal file
View file

@ -0,0 +1,6 @@
#compdef c
if [[ "$CODE_HOME" == "" && -d "$HOME/code" ]] ; then
_files -W $HOME/code
elif [ -d "$CODE_HOME" ]; then
_files -W "$CODE_HOME"
fi

13
plugins/c/c.plugin.zsh Normal file
View file

@ -0,0 +1,13 @@
# Quickly access your ~/code directory
# Setting $CODE_HOME will use that instead of ~/code
function c(){
local code_path=${CODE_HOME}
if [[ "$code_path" == "" ]]; then
code_path="$HOME/code"
fi
if [ -d "$code_path/$1" ]; then
cd "$code_path/$1"
fi
}