Skip to content

Instantly share code, notes, and snippets.

@eneuhauser
Last active February 17, 2020 17:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eneuhauser/a39b82c6d1f2f6491753eb5c434c5979 to your computer and use it in GitHub Desktop.
Save eneuhauser/a39b82c6d1f2f6491753eb5c434c5979 to your computer and use it in GitHub Desktop.
C2FO Project Tab Completion

Installation

  1. Put these in a $DOTFILES/zsh/functions folder
  2. Make sure completions is loaded in your ZSH
  3. Add functions path to the fpath in ~/.zshenv
  4. Autoload the functions in your ~/.zshrc
# ~/.zshenv
fpath=(
  $DOTFILES/zsh/functions
  $fpath
)
autoload -U compinit && compinit
# ~/.zshrc
if [[ -d $DOTFILES/zsh/functions ]]; then
  for func in $DOTFILES/zsh/functions/*(:t); autoload -U $func
fi
#compdef c
_alternative \
'src:Projects:_path_files -W "$C2FO_HOME/.." -/' \
'go:Go Projects:_path_files -W "$C2FO_GO" -/'
if [[ -e "$C2FO_HOME/../$1" ]]; then
cd "$C2FO_HOME/../$1"
elif [[ -e "$C2FO_GO/$1" ]]; then
cd "$C2FO_GO/$1"
else
cd "$C2FO_HOME/.."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment