my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
511 B

3 years ago
  1. alias pjo="pj open"
  2. function pj() {
  3. local cmd="cd"
  4. local project="$1"
  5. if [[ "open" == "$project" ]]; then
  6. shift
  7. project=$*
  8. cmd=${=EDITOR}
  9. else
  10. project=$*
  11. fi
  12. for basedir ($PROJECT_PATHS); do
  13. if [[ -d "$basedir/$project" ]]; then
  14. $cmd "$basedir/$project"
  15. return
  16. fi
  17. done
  18. echo "No such project '${project}'."
  19. }
  20. _pj () {
  21. local -a projects
  22. for basedir ($PROJECT_PATHS); do
  23. projects+=(${basedir}/*(/N))
  24. done
  25. compadd ${projects:t}
  26. }
  27. compdef _pj pj