Created
March 17, 2011 08:40
-
-
Save diasjorge/874014 to your computer and use it in GitHub Desktop.
cd command with autocomplete
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
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