Skip to content

Instantly share code, notes, and snippets.

@rondevera
Created April 21, 2011 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rondevera/935626 to your computer and use it in GitHub Desktop.
Save rondevera/935626 to your computer and use it in GitHub Desktop.
project_completion.bash
cdp(){
# For changing directly to a specific project's directory.
# Usage: `cdp bloombox`
local proj=$1
c "/Users/ron/Documents/Projects/$proj/"
settabtitle $proj
}
_cdp(){
# Tab completion routine for `cdp`:
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local words=$(ls -1p ~/Documents/Projects | grep /$ | sed "s/\/$//")
COMPREPLY=($(compgen -W "${words}" -- "$cur"))
}
complete -F _cdp -o nospace cdp # Enables tab completion for `cdp`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment