Created
August 3, 2012 15:48
-
-
Save onlytracks/3248894 to your computer and use it in GitHub Desktop.
Bash autocomplete directory names for cd alias
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 cdcode() { cd $HOME/code/$@ ;} | |
_cdcode () { local cur; cur=${COMP_WORDS[$COMP_CWORD]}; COMPREPLY=( $( compgen -d -- $HOME/code/ | grep $cur | xargs --no-run-if-empty -l1 basename ) ); return 0; } | |
complete -F _cdcode cdcode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment