Skip to content

Instantly share code, notes, and snippets.

@EdwardDrapkin
Last active February 24, 2017 19:23
Show Gist options
  • Save EdwardDrapkin/a936df8abefb56636d7dd5b4f93428da to your computer and use it in GitHub Desktop.
Save EdwardDrapkin/a936df8abefb56636d7dd5b4f93428da to your computer and use it in GitHub Desktop.
_complete_proj() {
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$( find -X ~/projects -name ${cur}* -maxdepth 1 -type d -prune | xargs basename )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0;
}
proj() {
cd ~/projects/$1
}
complete -F _complete_proj proj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment