Skip to content

Instantly share code, notes, and snippets.

@localhots
Created July 20, 2016 08:55
Show Gist options
  • Save localhots/bac081f3e9a5e93cffacd7f73ab530b1 to your computer and use it in GitHub Desktop.
Save localhots/bac081f3e9a5e93cffacd7f73ab530b1 to your computer and use it in GitHub Desktop.
PROJECTS=$HOME/Code
function c { cd $(realpath $PROJECTS/$1); }
function _c { __bash_directory_complete $PROJECTS; }
complete -F _c c
function __bash_directory_complete {
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=($(compgen -o nospace -W "$(ls $1)" -- $cur))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment