Skip to content

Instantly share code, notes, and snippets.

@jondeandres
Created January 14, 2013 01:50
Show Gist options
  • Save jondeandres/4527242 to your computer and use it in GitHub Desktop.
Save jondeandres/4527242 to your computer and use it in GitHub Desktop.
export PROJECTS=~/wuaki/
function cs {
local dest current
mkdir -p "$PROJECTS"
cd "$PROJECTS/$1"
}
function _cs_scandir
{
local base ext
base=$1
if [ -d $base ]; then
for d in `ls $base`; do
if [ -d $base/$d ]; then
dirs="$dirs $d"
fi
done
fi
}
function _cs()
{
local cur dirs
_cs_scandir "$PROJECTS"
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "${dirs}" -- ${cur}) )
}
complete -F _cs cs
@jondeandres
Copy link
Author

This file is taken and modified from the KDE project. You can use it with zsh if you write this in your .zshrc:

autoload -U bashcompinit
bashcompinit -i

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment