Created
August 31, 2011 01:38
-
-
Save jmibanez/1182616 to your computer and use it in GitHub Desktop.
.bashrc alias for changing into project directory (includes TAB completion)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _project_list () | |
{ | |
local cur prev | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
PROJECTS=$(ls -d ~/projects/*/ ~/projects/*/*/ | xargs basename) | |
COMPREPLY=( $(compgen -W "$PROJECTS" -- ${cur}) ) | |
return 0 | |
} | |
alias prj='CDPATH=~/projects/:~/projects/skunk/:~/projects/personal/:~/projects/codeflux/ cd "$@"' | |
complete -F _project_list pro |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment