Skip to content

Instantly share code, notes, and snippets.

@diasjorge
Created March 17, 2011 08:40
Show Gist options
  • Save diasjorge/874014 to your computer and use it in GitHub Desktop.
Save diasjorge/874014 to your computer and use it in GitHub Desktop.
cd command with autocomplete
ideupdir="/home/boston/development/ideup"
function cdi() {
dir="$ideupdir"
if [ -n $1 ]; then
dir="$dir/$1"
fi
cd $dir
}
function _cdi() {
local cur
cur=${COMP_WORDS[COMP_CWORD]}
subdirectories="$( cd $ideupdir && ls -d */ | sed 's/\///' )"
COMPREPLY=( $( compgen -W "$subdirectories" -- "$cur" ) )
}
complete -F _cdi cdi
function feup() {
(cd $2 && unp $1 && rm $1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment